fix: podman auto prune images and delete old update script

This commit is contained in:
Dominik Polakovics Polakovics 2026-02-09 03:07:02 +01:00
parent f3ef4ff11c
commit 507779e306
2 changed files with 2 additions and 39 deletions

View file

@ -15,6 +15,8 @@ let
do
$SUDO ${pkgs.podman}/bin/podman pull $image
done
$SUDO ${pkgs.podman}/bin/podman image prune -af
'';
in {
users.groups.podman.gid = cids.gids.podman;

View file

@ -1,39 +0,0 @@
{ config, pkgs, ... }:
let
update-containers = pkgs.writeShellScriptBin "update-containers" ''
SUDO=""
if [[ $(id -u) -ne 0 ]]; then
SUDO="sudo"
fi
images=$($SUDO ${pkgs.podman}/bin/podman ps -a --format="{{.Image}}" | sort -u)
for image in $images
do
$SUDO ${pkgs.podman}/bin/podman pull $image
done
'';
in {
systemd.timers = {
# ...
updatecontainers = {
timerConfig = {
Unit = "updatecontainers.service";
OnCalendar = "02:00";
};
wantedBy = [ "timers.target" ];
};
# ...
};
systemd.services = {
# ...
updatecontainers = {
serviceConfig = {
Type = "oneshot";
ExecStart = "update-containers";
};
};
# ...
};
}