macbook: drop nom, store auto-optimise, halve substitution jobs

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-09 09:07:59 +01:00
parent 80960a85cc
commit c385cd3713
2 changed files with 18 additions and 3 deletions

View file

@ -1,6 +1,15 @@
# Common.nix
{ config, pkgs, lib, inputs, ... }:
let
isMacbook = config.networking.hostName == "FredOS-Macbook";
# nom's Haskell renderer measured 91% CPU during a rebuild — a full core of
# the Macbook's four, spent drawing a progress tree, while nix itself wanted
# 146%. Plain `-L` output there; the other hosts can afford the pretty one.
buildLog = lib.optionalString (!isMacbook)
" --log-format internal-json 2>&1 | nom --json";
in
{
imports = [
# Host modules are imported per-host by mkHost in flake.nix.
@ -111,7 +120,7 @@
# Shell aliases (work in both bash and fish)
environment.shellAliases = {
update = "bash -c 'set -o pipefail && OLD_SYSTEM=$(readlink /run/current-system) && sudo nixos-rebuild switch $@ --refresh --flake git+https://forg.gregersen.it/rope/nixos -L --log-format internal-json 2>&1 | nom --json && nvd diff $OLD_SYSTEM /run/current-system && (command -v record-update &>/dev/null && record-update $OLD_SYSTEM /run/current-system || true)' --";
update = "bash -c 'set -o pipefail && OLD_SYSTEM=$(readlink /run/current-system) && sudo nixos-rebuild switch $@ --refresh --flake git+https://forg.gregersen.it/rope/nixos -L${buildLog} && nvd diff $OLD_SYSTEM /run/current-system && (command -v record-update &>/dev/null && record-update $OLD_SYSTEM /run/current-system || true)' --";
clean = "sudo nix-collect-garbage -d";
ll = "ls -alh";
clear = "command clear";
@ -131,7 +140,11 @@
# Hard-link identical files in the store as new paths are added, so the
# store de-duplicates itself on every build instead of drifting.
nix.settings.auto-optimise-store = true;
# Off on the Macbook: it hashes and relinks every file the daemon writes,
# which lands on top of the substitution writes on a slow SATA blade —
# measured io pressure full avg60=57% during a rebuild. Run `nix store
# optimise` by hand there if the store ever gets fat.
nix.settings.auto-optimise-store = !isMacbook;
# Offload builds to the media server. Excluded on the server itself to
# avoid a pointless SSH round-trip to localhost.

View file

@ -25,7 +25,9 @@
# out-of-tree broadcom_sta (wl) driver drops association mid-build —
# only a manual wifi reconnect brings it back. Cap the concurrency.
nix.settings.http-connections = 8;
nix.settings.max-substitution-jobs = 4;
# 2, not 4: each job is an xz/zstd decompress, and there are only 4 threads
# to share with the desktop. 4 just queues them behind each other.
nix.settings.max-substitution-jobs = 2;
services.tlp.enable = false;
services.power-profiles-daemon.enable = true;