From 3164185b1168ea91cb83b28c2ff62555315780ff Mon Sep 17 00:00:00 2001 From: clover caruso Date: Sat, 24 Oct 2026 18:30:23 -0700 Subject: [PATCH] Prune old dashboard images daily Every dashboard build leaves an image on the nearly full root disk. Pre-start reloads any release's image from the Nix store, so only images in use need to stay. Assisted-by: claude-opus-5.5 --- nixos/configuration.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 330f6b57f6ed078b44ceb7164b35d2ad914e1ef3..d3c524e1659df9588b41f93561eeca536e440328 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -178,6 +178,21 @@ in RestartSec = 2; }; }; + # Every dashboard build leaves an image; pre-start reloads any release's image from the Nix store. + systemd.timers.snowglobe-image-prune = { + wantedBy = [ "timers.target" ]; + timerConfig = { OnCalendar = "daily"; Persistent = true; }; + }; + systemd.services.snowglobe-image-prune = { + path = [ pkgs.podman ]; + serviceConfig.Type = "oneshot"; + # rmi refuses images a container still uses. + script = '' + for image in $(podman images --quiet --filter reference=localhost/snowglobe-dashboard); do + podman rmi "$image" || true + done + ''; + }; systemd.timers.snowglobe-vm-expiry = { wantedBy = [ "timers.target" ]; timerConfig = { OnBootSec = "1min"; OnUnitActiveSec = "1min"; }; -- 2.54.1