1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-02 23:21:02 +01:00

treewide: remove with lib (#6871)

Remove from services.
This commit is contained in:
Austin Horstman 2025-04-21 09:00:59 -07:00 committed by GitHub
parent 6695b1d477
commit 82ee14ff60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
124 changed files with 1848 additions and 1891 deletions

View file

@ -4,23 +4,20 @@
pkgs,
...
}:
with lib;
let
cfg = config.services.podman;
in
{
options.services.podman = {
autoUpdate = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Automatically update the podman images.";
};
onCalendar = mkOption {
type = types.str;
onCalendar = lib.mkOption {
type = lib.types.str;
default = "Sun *-*-* 00:00";
description = ''
The systemd `OnCalendar` expression for the update. See
@ -30,63 +27,65 @@ in
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.autoUpdate.enable {
systemd.user.services."podman-auto-update" = {
Unit = {
Description = "Podman auto-update service";
Documentation = "man:podman-auto-update(1)";
Wants = [ "network-online.target" ];
After = [ "network-online.target" ];
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
(lib.mkIf cfg.autoUpdate.enable {
systemd.user.services."podman-auto-update" = {
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=${
builtins.concatStringsSep ":" [
"/run/wrappers/bin"
"/run/current-system/sw/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
]
}";
ExecStart = "${cfg.package}/bin/podman auto-update";
ExecStartPost = "${cfg.package}/bin/podman image prune -f";
TimeoutStartSec = "300s";
TimeoutStopSec = "10s";
};
};
systemd.user.timers."podman-auto-update" = {
Unit = {
Description = "Podman auto-update timer";
};
Timer = {
OnCalendar = cfg.autoUpdate.onCalendar;
RandomizedDelaySec = 300;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
})
({
xdg.configFile."systemd/user/podman-user-wait-network-online.service.d/50-exec-search-path.conf".text =
''
[Service]
ExecSearchPath=${
makeBinPath (
with pkgs;
[
bashInteractive
systemd
coreutils
Service = {
Type = "oneshot";
Environment = "PATH=${
builtins.concatStringsSep ":" [
"/run/wrappers/bin"
"/run/current-system/sw/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
]
)
}:/bin
'';
})
]);
}";
ExecStart = "${cfg.package}/bin/podman auto-update";
ExecStartPost = "${cfg.package}/bin/podman image prune -f";
TimeoutStartSec = "300s";
TimeoutStopSec = "10s";
};
};
systemd.user.timers."podman-auto-update" = {
Unit = {
Description = "Podman auto-update timer";
};
Timer = {
OnCalendar = cfg.autoUpdate.onCalendar;
RandomizedDelaySec = 300;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
})
{
xdg.configFile."systemd/user/podman-user-wait-network-online.service.d/50-exec-search-path.conf".text =
''
[Service]
ExecSearchPath=${
lib.makeBinPath (
with pkgs;
[
bashInteractive
systemd
coreutils
]
)
}:/bin
'';
}
]
);
}