-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
57 lines (57 loc) · 1.91 KB
/
flake.nix
File metadata and controls
57 lines (57 loc) · 1.91 KB
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
{
outputs = _: {
lib = {
assertBootstrap =
opts:
(
let
nixpkgs = opts.nixpkgs;
paths = opts.paths;
lib = nixpkgs.lib;
forEachSystem =
f:
builtins.foldl' lib.recursiveUpdate { } (
map f [
"aarch64-linux"
"aarch64-darwin"
"x86_64-linux"
]
);
lixDrvs = forEachSystem (system: {
${system} = nixpkgs.legacyPackages.${system}.lixStatic;
});
esc = builtins.fromJSON "\"\\u001b\"";
red = "${esc}[31m";
grn = "${esc}[32m";
rst = "${esc}[0m";
gry = "${esc}[90m";
blue = "${esc}[34m";
magenta = "${esc}[35m";
bold = "${esc}[1m";
expected =
"bootstrap-lix:"
+ builtins.toJSON (
builtins.builtins.listToAttrs (
map (arch: {
name = arch;
value = lixDrvs.${arch}.outPath;
}) (builtins.attrNames lixDrvs)
)
);
pathPos = builtins.unsafeGetAttrPos "paths" opts;
in
lib.asserts.assertMsg (paths == expected) (
"please update assertBootstrap paths:\n"
+ "${bold}${blue}at ${magenta}${pathPos.file}:${builtins.toString pathPos.line}:${builtins.toString pathPos.column}${rst}:\n"
+ " ${gry}| ...${rst}\n"
+ " ${gry}|${rst} assert bootstrap.lib.assertBootstrap {\n"
+ " ${gry}|${rst} inherit nixpkgs;\n"
+ " ${gry}|${red}- paths = ${builtins.toJSON paths};${rst}\n"
+ " ${gry}|${grn}+ paths = ${builtins.toJSON expected};${rst}\n"
+ " ${gry}|${rst} };\n"
+ " ${gry}| ...${rst}"
)
);
};
};
}