impure.nix: Add extendModules to hosts.* #4

Merged
colin merged 1 commits from shelvacu/colins-nix-files:patch-add-host-extendModules into master 2025-03-08 09:33:26 +00:00

View File

@@ -24,19 +24,20 @@ let
pkgs.sops-nix.nixosModules.sops pkgs.sops-nix.nixosModules.sops
]; ];
mkFlavoredHost = args: let mkFlavoredHost = args: let
host = evalHost args; plainHost = evalHost args;
# expose the toplevel nixos system as the toplevel attribute itself, # expose the toplevel nixos system as the toplevel attribute itself,
# with nested aliases for other common build targets # with nested aliases for other common build targets
in host.config.system.build.toplevel.overrideAttrs (base: { addPassthru = host: host.config.system.build.toplevel.overrideAttrs (base: {
passthru = (base.passthru or {}) // { passthru = (base.passthru or {}) // {
config = host.config; inherit (host) config;
fs = host.config.sane.fs; inherit (host.config.sane) fs;
img = host.config.system.build.img; inherit (host.config.system.build) imgs pkgs;
pkgs = host.config.system.build.pkgs; programs = builtins.mapAttrs (_: p: p.package) host.config.sane.programs;
programs = builtins.mapAttrs (_: p: p.package) host.config.sane.programs; toplevel = host.config.system.build.toplevel; #< self
toplevel = host.config.system.build.toplevel; #< self extendModules = arg: addPassthru (host.extendModules arg);
}; };
}); });
in addPassthru plainHost;
mkHost = args: { mkHost = args: {
# TODO: swap order: $host-{next,staging}-{min,light}: # TODO: swap order: $host-{next,staging}-{min,light}:
# then lexicographically-adjacent targets would also have the minimal difference in closure, # then lexicographically-adjacent targets would also have the minimal difference in closure,