Initial commit

This commit is contained in:
Shawn Borton 2026-06-21 01:36:08 -05:00
commit a4db9c8516
36 changed files with 15659 additions and 0 deletions

View file

@ -0,0 +1,45 @@
{ pkgs, lib, config, ... }: {
virtualisation = {
containers.enable = true;
oci-containers.backend = "podman";
podman = {
enable = true;
autoPrune = {
enable = true;
flags = [ "--all" "--filter 'until=24h'" "--force" ];
};
dockerCompat = true;
};
};
networking.firewall.interfaces = let
matchAll =
if !config.networking.nftables.enable then "podman+" else "podman*";
in { "${matchAll}".allowedUDPPorts = [ 53 ]; };
# If you want to trigger this service manually, run sudo systemctl restart update-containers.service.
systemd.services.updatecontainers = {
serviceConfig = {
Type = "oneshot";
User = "portainer";
ExecStart = lib.getExe (pkgs.writeShellScriptBin "update-containers" ''
images=$(${pkgs.podman}/bin/podman ps -a --format="{{.Image}}" | sort -u)
for image in $images; do
${pkgs.podman}/bin/podman pull "$image"
done
'');
};
};
systemd.user.timers = {
updatecontainers = {
unitConfig.ConditionUser = "portainer";
timerConfig = {
Unit = "updatecontainers.service";
OnCalendar = "Sun 02:03";
};
wantedBy = [ "timers.target" ];
};
};
}