diff --git a/parts/lib/builders.nix b/parts/lib/builders.nix index 9822c31..aac7266 100644 --- a/parts/lib/builders.nix +++ b/parts/lib/builders.nix @@ -1,6 +1,8 @@ {inputs, ...}: let inherit (inputs) self nixpkgs; inherit (nixpkgs) lib; + inherit (lib) mkDefault nixosSystem recursiveUpdate singleton; + inherit (builtins) concatLists; in { mkSystem = { withSystem, @@ -13,17 +15,27 @@ in { self', ... }: - lib.nixosSystem { + nixosSystem { inherit system; specialArgs = - lib.recursiveUpdate + recursiveUpdate { inherit lib; inherit inputs inputs'; inherit self self'; } (args.specialArgs or {}); - inherit (args) modules; + modules = concatLists [ + # This is used to pre-emptively set the hostPlatform for nixpkgs. + # We need a singleton here since we concatenate lists, and a singleton + # generates a list with a single element. + (singleton { + nixpkgs.hostPlatform = mkDefault args.system; + }) + + # We pass our modules from the arguments + (args.modules or []) + ]; } ); } diff --git a/parts/lib/default.nix b/parts/lib/default.nix index 85a844d..c544c46 100644 --- a/parts/lib/default.nix +++ b/parts/lib/default.nix @@ -44,6 +44,6 @@ in { # `flake.lib` is set. flake = { lib = extendedLib; - _module.args.lib = extendedLib; + # _module.args.lib = extendedLib; }; }