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"; };