]> git.scottworley.com Git - nixos-qemu-vm-isolation/blob - lib/tier1.nix
23.05: New way to get the list of tier1 systems
[nixos-qemu-vm-isolation] / lib / tier1.nix
1 # Since 168b926435628cb06c4a8cb0f3e6f69f141529f1, we do shenanigans to get the tier1 list. :(
2
3 nixpkgs:
4
5 let
6 inherit (nixpkgs) lib;
7 inherit (lib) elemAt foldl' isList splitString;
8 inherit (builtins) readFile;
9
10 lines = splitString "\n";
11
12 between = start: stop: list:
13 let
14 step = state: x:
15 if isNull state && x == start then
16 [ ]
17 else if isList state then
18 if x == stop then { result = state; } else state ++ [ x ]
19 else
20 state;
21 in (foldl' step null list).result;
22
23 strip-quotes = x: elemAt (builtins.match " \"(.*)\"" x) 0;
24
25 systems-file = "${nixpkgs}/lib/systems/flake-systems.nix";
26
27 in map strip-quotes
28 (between " # Tier 1" " # Tier 2" (lines (readFile systems-file)))