From 256fac99adc3a534dc1097ac45307101e6a10d6d Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 6 Oct 2022 14:03:52 -0500 Subject: [PATCH] Tidy up legacyPackages instantiation --- flake.nix | 29 +++++++++++++---------------- nixos-modules/default.nix | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index d428ede..85508b3 100644 --- a/flake.nix +++ b/flake.nix @@ -180,22 +180,19 @@ }); - legacyPackages = - # The nixpkgs.legacyPackages set after overlaying. - let f = import nixpkgs; - in forAllSystems ({ system, localSystem, crossSystem }: - if localSystem == crossSystem then - nixpkgs.legacyPackages.${system}.appendOverlays overlays - else - f { - inherit localSystem; - crossSystem = { - system = crossSystem; - useLLVM = true; - }; - config.allowUnsupportedSystem = true; - inherit overlays; - }); + legacyPackages = forAllSystems ({ system, localSystem, crossSystem }: + if builtins.hasAttr system nixpkgs.legacyPackages then + nixpkgs.legacyPackages.${system}.appendOverlays overlays + else + import nixpkgs { + inherit localSystem; + crossSystem = { + system = crossSystem; + useLLVM = true; + }; + config.allowUnsupportedSystem = true; + inherit overlays; + }); packages = # Genode native packages, not packages in the traditional diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix index a1c21f5..b6e9e39 100644 --- a/nixos-modules/default.nix +++ b/nixos-modules/default.nix @@ -13,7 +13,7 @@ ./qemu-vm.nix ./services ]; - nixpkgs = { + nixpkgs = rec { localSystem.system = "x86_64-linux"; crossSystem.system = "x86_64-genode"; system = localSystem.system + "-" + crossSystem.system;