From e849827ebba7ad8cd8dc0953a06b26cb81a1833c Mon Sep 17 00:00:00 2001 From: Erik Simon Date: Wed, 14 Oct 2026 23:32:37 +0200 Subject: [PATCH] =?UTF-8?q?feat(mercury):=20trim=20closure=202.9G=20?= =?UTF-8?q?=E2=86=92=201.6G;=20deploy=20with=20--use-substitutes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- hosts/mercury/configuration.nix | 16 ++++++++++++++++ scripts/deploy | 3 +++ 2 files changed, 19 insertions(+) diff --git a/hosts/mercury/configuration.nix b/hosts/mercury/configuration.nix index a9abd3d..acf00e2 100644 --- a/hosts/mercury/configuration.nix +++ b/hosts/mercury/configuration.nix @@ -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"; } diff --git a/scripts/deploy b/scripts/deploy index 000d9b4..5a868b0 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -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}"