From 73c8b626455f7de1c71bb65a2433b0224ac18b81 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Tue, 2 Mar 2021 23:35:55 +0100 Subject: [PATCH] Simplify flake.nix --- flake.nix | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/flake.nix b/flake.nix index 39c5624..4932771 100644 --- a/flake.nix +++ b/flake.nix @@ -35,23 +35,6 @@ crossSystem = system; })); - nixpkgsFor = forAllSystems ({ system, localSystem, crossSystem }: - if localSystem == crossSystem then - import nixpkgs { - inherit system; - overlays = [ self.overlay nimble.overlay ]; - } - else - import nixpkgs { - inherit localSystem; - crossSystem = { - system = crossSystem; - useLLVM = true; - }; - config.allowUnsupportedSystem = true; - overlays = [ self.overlay nimble.overlay ]; - }); - in rec { overlay = @@ -164,19 +147,33 @@ }); - legacyPackages = - # The nixpkgs.legacyPackages after overlaying - # and with some additional Genode packages - forAllSystems - ({ system, localSystem, crossSystem }: nixpkgsFor.${system}); - # pass thru Nixpkgs + /* The nixpkgs.legacyPackages after overlaying + and with some additional Genode packages. + */ + legacyPackages = let f = import nixpkgs; + in forAllSystems ({ system, localSystem, crossSystem }: + if localSystem == crossSystem then + f { + inherit system; + overlays = [ self.overlay nimble.overlay ]; + } + else + f { + inherit localSystem; + crossSystem = { + system = crossSystem; + useLLVM = true; + }; + config.allowUnsupportedSystem = true; + overlays = [ self.overlay nimble.overlay ]; + }); packages = # Genode native packages, not packages in the traditional # sense in that these cannot be installed within a profile forAllCrossSystems ({ system, localSystem, crossSystem }: nixpkgs.lib.filterAttrs (n: v: v != null) - nixpkgsFor.${system}.genodePackages); + self.legacyPackages.${system}.genodePackages); devShell = # Development shell for working with the @@ -232,7 +229,7 @@ inherit system localSystem crossSystem; pkgs = self.legacyPackages.${system}; } // { - ports = nixpkgsFor.${localSystem}.symlinkJoin { + ports = self.legacyPackages.${localSystem}.symlinkJoin { name = "ports"; paths = (builtins.attrValues self.packages.${system}.genodeSources.ports);