Skip to content

Commit

Permalink
feat: add virtualisation.user.quadlet.autoUpdate to home-manager module
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramblurr committed Apr 10, 2024
1 parent ff17add commit 217c0a8
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions home-manager-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ let
in
{
options.virtualisation.user.quadlet = {
autoUpdate = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
calendar = lib.mkOption {
type = lib.types.str;
default = "*-*-* 00:00:00";
};
};
containers = lib.mkOption {
type = lib.types.attrsOf containerOpts;
default = { };
Expand Down Expand Up @@ -59,5 +69,32 @@ in
};
}) allObjects
);
systemd.user.services.podman-auto-update = lib.mkIf cfg.autoUpdate.enable {
Unit = {
Description = "Podman auto-update service";
Documentation = "man:podman-auto-update(1)";
Wants = [ "network-online.target" ];
After = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
Environment = "PATH=/run/wrappers/bin:/run/current-system/sw/bin";
ExecStart = "${pkgs.podman}/bin/podman auto-update";
ExecStartPost = "${pkgs.podman}/bin/podman image prune -f";
TimeoutStartSec = "900s";
TimeoutStopSec = "10s";
};
};
systemd.user.timers.podman-auto-update = lib.mkIf cfg.autoUpdate.enable {
Unit = {
Description = "Podman auto-update timer";
Documentation = "man:podman-auto-update(1)";
};
Timer = {
OnCalendar = cfg.autoUpdate.calendar;
Persistent = true;
};
Install.WantedBy = [ "timers.target" ];
};
};
}

0 comments on commit 217c0a8

Please sign in to comment.