-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
flake.nix
89 lines (81 loc) · 2.23 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
{
description = "Rust toolchains and rust analyzer nightly for nix";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-analyzer-src = {
url = "github:rust-lang/rust-analyzer/nightly";
flake = false;
};
};
outputs = { self, nixpkgs, rust-analyzer-src }:
let
inherit (builtins)
concatStringsSep
isAttrs
;
inherit (nixpkgs.lib)
concatMapAttrs
genAttrs
isDerivation
isFunction
warn
;
eachSystem = genAttrs [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
attrDerivations = set: path: (concatMapAttrs
(k: v:
if isDerivation v then
{ ${concatStringsSep "." (path ++ [ k ])} = v; }
else if isAttrs v then
attrDerivations v (path ++ [ k ])
else
{ })
set);
in
{
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
packages = eachSystem (system: concatMapAttrs
(k: v:
if isDerivation v then
{ ${k} = v; }
else if isFunction v then
{
${k} = {
type = "derivation";
name = "dummy-function";
__functor = _: v;
};
}
else if isAttrs v then
(if k == "targets" then
genAttrs
(map (x: "targets.<triple>.${x}.rust-std") [ "stable" "beta" "latest" ])
(_: {
type = "derivation";
name = "dummy-rust-std";
})
else
attrDerivations v [ k ])
// {
${k} = {
type = "derivation";
name = "dummy-attrset";
} // v;
}
else v)
(import ./. {
inherit system rust-analyzer-src;
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
}));
overlay = warn
"`fenix.overlay` is deprecated; use 'fenix.overlays.default' instead"
self.overlays.default;
overlays.default = import ./overlay.nix;
};
}