From a405850cf8f323960f55e8aeda8a6fee9909d761 Mon Sep 17 00:00:00 2001 From: Shelvacu Date: Tue, 4 Mar 2025 12:23:20 -0800 Subject: [PATCH] `impure.nix`: Add extendModules to hosts.* With this something like `hosts.servo.extendModules { networking.hostname = "shel-is-awesome"; }` works as expected. Mirrors the functionality of extendModules on the result of evalConfig --- impure.nix | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/impure.nix b/impure.nix index 2d39bf1ae..929d4bf84 100644 --- a/impure.nix +++ b/impure.nix @@ -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,