-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
108 lines (96 loc) · 2.9 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{
description = "A `git-worktree(1)` manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
crane = {
url = "github:ipetkov/crane";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
};
nixConfig = {
extra-substituters = [
"https://cache.garnix.io"
"https://9999years.cachix.org"
];
extra-trusted-substituters = [
"https://cache.garnix.io"
"https://9999years.cachix.org"
];
extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"9999years.cachix.org-1:C6zdfIAI7Sj8X2Ws6B/SLLEkoHBsLvCpKizBhqNz72g="
];
};
outputs =
inputs@{
self,
nixpkgs,
systems,
crane,
rust-overlay,
advisory-db,
}:
let
eachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
_pkgs = eachSystem (
localSystem:
import nixpkgs {
inherit localSystem;
overlays = [
rust-overlay.overlays.default
(final: prev: {
rustToolchain = final.pkgsBuildHost.rust-bin.stable.latest.default.override {
targets =
final.lib.optionals final.stdenv.targetPlatform.isDarwin [
"x86_64-apple-darwin"
"aarch64-apple-darwin"
]
++ final.lib.optionals final.stdenv.targetPlatform.isLinux [
"x86_64-unknown-linux-musl"
"aarch64-unknown-linux-musl"
];
extensions = [ "llvm-tools-preview" ];
};
craneLib = (crane.mkLib final).overrideToolchain final.rustToolchain;
})
];
}
);
packages = eachSystem (
localSystem:
let
pkgs = self._pkgs.${localSystem};
inherit (pkgs) lib;
packages = pkgs.callPackage ./nix/makePackages.nix { inherit inputs; };
in
(lib.filterAttrs (name: value: lib.isDerivation value) packages)
// {
default = packages.git-prole;
git-prole-user-manual = packages.git-prole.user-manual;
git-prole-user-manual-tar-xz = packages.git-prole.user-manual-tar-xz;
# This lets us use `nix run .#cargo` to run Cargo commands without
# loading the entire `nix develop` shell (which includes
# `rust-analyzer`).
#
# Used in `.github/workflows/release.yaml`.
cargo = pkgs.cargo;
}
);
checks = eachSystem (system: self.packages.${system}.default.checks);
devShells = eachSystem (system: {
default = self.packages.${system}.default.devShell;
});
};
}