From 1ed758bb77c680fc351822dac7ab0e2e143d1e0e Mon Sep 17 00:00:00 2001 From: Yuto Nishida Date: Sat, 22 Aug 2026 13:42:12 -0700 Subject: [PATCH] [venus] sodium: drop the orphaned aarch64-linux linux-builder Nothing in the repo targets aarch64-linux: every NixOS host and deploy node is x86_64-linux (built on methanol via nix.buildMachines) and sodium itself is aarch64-darwin. The auto-managed linux-builder was left aarch64-only after x86_64 moved to methanol, so it had no consumer -- yet its LaunchDaemon booted a VM on every login and its persistent qcow2 sat at ~6.8 GB. Remove nix.linux-builder from sodium.nix and the reset-linux-builder flake app that existed only to service that VM. x86_64-linux offloading to methanol is unchanged. After switching, darwin-rebuild boots out org.nixos.linux-builder; the /var/lib/linux-builder state dir is removed separately to reclaim the space. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01ExFhByQGeEwr9j5Kvs7sfN --- flake-profiles/system-sodium/flake.nix | 46 +------------------------- venus/modules/nixos-darwin/sodium.nix | 14 +------- 2 files changed, 2 insertions(+), 58 deletions(-) diff --git a/flake-profiles/system-sodium/flake.nix b/flake-profiles/system-sodium/flake.nix index 316639c..cb7b74a 100644 --- a/flake-profiles/system-sodium/flake.nix +++ b/flake-profiles/system-sodium/flake.nix @@ -57,51 +57,7 @@ ]; }; - outputs = inputs @ { self, nixpkgs, ... }: let - system = "aarch64-darwin"; - pkgs = nixpkgs.legacyPackages.${system}; - in { - # Recover the linux-builder VM from nix-store corruption (symptom: x86_64-linux - # builds fail with `path '…' is not valid` because the guest's binfmt config got - # truncated, so QEMU x86_64 emulation never registers). Resets the persistent - # qcow2 disk (keys/ are preserved) so the build closure re-copies cleanly. - # nix run ./flake-profiles/system-sodium#reset-linux-builder - packages.${system}.reset-linux-builder = pkgs.writeShellApplication { - name = "reset-linux-builder"; - runtimeInputs = [ pkgs.coreutils ]; - text = '' - set -euo pipefail - - echo "Resetting the linux-builder VM (you will be prompted for sudo)." - echo "This wipes the builder's persistent nix store (keys/ are preserved) and" - echo "forces a clean re-copy of the build closure on next build. Use it to" - echo "recover from 'path ... is not valid' x86_64-linux build failures." - echo - - sudo launchctl bootout system/org.nixos.linux-builder || echo "(service was not running)" - sleep 2 - sudo rm -f /var/lib/linux-builder/nixos.qcow2 - sudo launchctl bootstrap system /Library/LaunchDaemons/org.nixos.linux-builder.plist - - echo "Waiting for the builder to come back up..." - for _ in $(seq 1 40); do - if sudo ssh -i /etc/nix/builder_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=3 builder@linux-builder true 2>/dev/null; then - break - fi - sleep 3 - done - - echo "Verifying x86_64 emulation is registered..." - if sudo ssh -i /etc/nix/builder_ed25519 -o StrictHostKeyChecking=no builder@linux-builder "test -e /proc/sys/fs/binfmt_misc/x86_64-linux"; then - echo "OK: x86_64-linux binfmt handler is registered. The builder is ready." - else - echo "WARNING: x86_64-linux binfmt handler not found. Inspect the builder:" - echo " sudo ssh -i /etc/nix/builder_ed25519 builder@linux-builder" - exit 1 - fi - ''; - }; - + outputs = inputs @ { self, nixpkgs, ... }: { darwinConfigurations."Yutos-Sodium" = inputs.nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; modules = [ diff --git a/venus/modules/nixos-darwin/sodium.nix b/venus/modules/nixos-darwin/sodium.nix index f292cb5..075df76 100644 --- a/venus/modules/nixos-darwin/sodium.nix +++ b/venus/modules/nixos-darwin/sodium.nix @@ -86,7 +86,7 @@ in distributedBuilds = true; # methanol (the cluster/storage node) is a NATIVE x86_64-linux box (16 cores / 27 GB), so x86_64 # builds -- e.g. whale's container images -- are offloaded to it instead of emulating x86 on the M1 - # via the linux-builder (QEMU TCG, ~5-8x slower). The image BUILDS on methanol; nix then copies the + # (QEMU TCG, ~5-8x slower). The image BUILDS on methanol; nix then copies the # result back here, and the whale push-script still runs LOCALLY with the local skopeo credentials # (see whale/outputs.nix / whale/readme.md). Reached over the LAN as the dedicated, unprivileged # `remote-builder` user (defined + added to trusted-users in methanol.nix; deploy-rs still uses @@ -112,18 +112,6 @@ in # methanol substitutes build inputs from the public caches itself rather than this Mac uploading # them (this aarch64-darwin host has no x86_64-linux store paths to send anyway). settings.builders-use-substitutes = true; - - # The auto-managed darwin linux-builder, now for aarch64-linux ONLY (x86_64 goes to methanol above). - linux-builder = { - enable = true; - maxJobs = 4; - # aarch64-linux ONLY (the module default). x86_64-linux is built natively by methanol (see - # buildMachines above), so there's no QEMU x86 emulation here and the VM keeps its small default - # size (1 vCPU / 3 GB). - # - # If an aarch64-linux build fails with `path '…' is not valid` (guest store corruption), reset: - # nix run ./flake-profiles/system-sodium#reset-linux-builder - }; }; # Create /etc/zshrc that loads the nix-darwin environment. -- 2.51.2