]> git.scottworley.com Git - nixos-qemu-vm-isolation/commitdiff
23.05: New way to get the list of tier1 systems
authorScott Worley <scottworley@scottworley.com>
Thu, 22 Jun 2023 21:24:51 +0000 (14:24 -0700)
committerScott Worley <scottworley@scottworley.com>
Thu, 22 Jun 2023 21:25:57 +0000 (14:25 -0700)
flake.lock
flake.nix
lib/tier1.nix [new file with mode: 0644]

index 0faa452ad0e271fe97996070bdcab8f668d6db07..0ec3471f5b955b565cda24c79316bed1ab1200be 100644 (file)
@@ -2,11 +2,11 @@
   "nodes": {
     "nixpkgs": {
       "locked": {
   "nodes": {
     "nixpkgs": {
       "locked": {
-        "lastModified": 1639876010,
-        "narHash": "sha256-naGsoUfsY92NaIGiFI8XFXBnesw8BQGe694xcfaLMDI=",
+        "lastModified": 1686960236,
+        "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
         "owner": "NixOS",
         "repo": "nixpkgs",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "395879c28386e1abf20c7ecacd45880759548391",
+        "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
         "type": "github"
       },
       "original": {
         "type": "github"
       },
       "original": {
index 757331ddf4927e363eb0b224bdf1e24124b8f3d4..ddce3f9f292a287d3c24b39afd0a56ecee033f7c 100644 (file)
--- a/flake.nix
+++ b/flake.nix
@@ -4,7 +4,7 @@
     let
       inherit (nixpkgs.lib) genAttrs;
 
     let
       inherit (nixpkgs.lib) genAttrs;
 
-      systems = nixpkgs.lib.systems.supported.tier1;
+      systems = import ./lib/tier1.nix nixpkgs;
 
       forAllSystems = genAttrs systems;
 
 
       forAllSystems = genAttrs systems;
 
diff --git a/lib/tier1.nix b/lib/tier1.nix
new file mode 100644 (file)
index 0000000..beb5e35
--- /dev/null
@@ -0,0 +1,28 @@
+# Since 168b926435628cb06c4a8cb0f3e6f69f141529f1, we do shenanigans to get the tier1 list.  :(
+
+nixpkgs:
+
+let
+  inherit (nixpkgs) lib;
+  inherit (lib) elemAt foldl' isList splitString;
+  inherit (builtins) readFile;
+
+  lines = splitString "\n";
+
+  between = start: stop: list:
+    let
+      step = state: x:
+        if isNull state && x == start then
+          [ ]
+        else if isList state then
+          if x == stop then { result = state; } else state ++ [ x ]
+        else
+          state;
+    in (foldl' step null list).result;
+
+  strip-quotes = x: elemAt (builtins.match "  \"(.*)\"" x) 0;
+
+  systems-file = "${nixpkgs}/lib/systems/flake-systems.nix";
+
+in map strip-quotes
+(between "  # Tier 1" "  # Tier 2" (lines (readFile systems-file)))