WIP create ergonomic per-system flake helper

This commit is contained in:
xenia 2024-11-14 13:34:37 -05:00
parent f809786caf
commit 175e2fb067
1 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,20 @@
]; ];
} // builtins.removeAttrs args [ "modules" ] } // builtins.removeAttrs args [ "modules" ]
); );
mkFlake = flakeDef:
let
rewritePerSystem = sectionDef: (forAllSystems (system:
builtins.mapAttrs (name: value:
nixpkgs.legacyPackages.${system}.callPackage value {}
) sectionDef
));
in
builtins.mapAttrs (name: value:
if name == "packages" || name == "legacyPackages" || name == "devShells" then
rewritePerSystem value
else
value
) flakeDef;
}); });
legacyPackages = forAllSystems (system: legacyPackages = forAllSystems (system: