From 175e2fb067d48bf2dfdc0f2e722895dfac9d1ca9 Mon Sep 17 00:00:00 2001 From: xenia Date: Thu, 14 Nov 2024 13:34:37 -0500 Subject: [PATCH] WIP create ergonomic per-system flake helper --- flake.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/flake.nix b/flake.nix index 3902010..2996103 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,20 @@ ]; } // 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: