feat(mercury): trim closure 2.9G → 1.6G; deploy with --use-substitutes

mercury drops the sd-image installer profile (rescue tools, ZFS), linux-firmware,
docs, installer tools and the nixpkgs registry pin — every deploy rewrites the
changed closure onto the SD card.

deploy switch/boot/test now passes --use-substitutes on all hosts: targets pull
cache hits themselves (compressed) instead of the laptop pushing uncompressed
NARs over ssh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 23:32:37 +02:00
co-authored by Claude Opus 5.5
parent a05057a074
commit e849827ebb
2 changed files with 19 additions and 0 deletions
+16
View File
@@ -46,6 +46,22 @@
virtualisation.oci-containers.containers.pihole.environmentFiles =
[ config.sops.templates."pihole.env".path ];
# ---- Closure trim ----
# Every deploy rewrites the changed closure onto the SD card, so drop what the
# sd-image module pulls in for installer use (2.9G → 1.6G).
# base.nix = installer rescue tools + ZFS/xfs/btrfs support.
disabledModules = [ "profiles/base.nix" ];
environment.systemPackages = [ pkgs.tcpdump ]; # kept from base.nix: DHCP debugging
# ~850M of linux-firmware; eth0 needs none and the Pi's GPU firmware lives on
# the FIRMWARE partition. Re-enable if WiFi/Bluetooth is ever used.
hardware.enableRedistributableFirmware = lib.mkForce false;
documentation.enable = false;
system.disableInstallerTools = true; # nixos-rebuild runs on the laptop, not here
# Pins nixpkgs' ~200M source into the closure; `nix shell nixpkgs#…` here
# falls back to the global registry instead.
nixpkgs.flake.setFlakeRegistry = false;
nixpkgs.flake.setNixPath = false;
# Do not modify after first flash.
system.stateVersion = "26.05";
}
+3
View File
@@ -672,9 +672,12 @@ case "$cmd" in
echo ">> nixos-rebuild $cmd .#$config on darman@$host"
# --ask-sudo-password, not the deprecated --use-remote-sudo: common.nix sets
# wheelNeedsPassword = true, and --use-remote-sudo never actually prompts.
# --use-substitutes: the target pulls cache hits itself (compressed) instead
# of the laptop pushing uncompressed NARs over ssh; misses are still pushed.
rebuild=(nix run nixpkgs#nixos-rebuild -- "$cmd"
--flake ".#$config"
--target-host "darman@$host"
--use-substitutes
--ask-sudo-password)
item="${HOMELAB_PASS_ITEM:-darman@$config}"