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