{ config, pkgs, ... }: let container_name = "adguard"; compose_file = "podman/adguard/compose.yaml"; config_dir = "/mnt/config/adguard"; in { config = { environment.etc."${compose_file}".text = /* yaml */ '' ''; systemd.services.${container_name} = { description = "Podman container : ${container_name}"; after = [ "network.target" "traefik.service" ]; wantedBy = [ "multi-user.target" ]; path = [ pkgs.podman-compose pkgs.podman ]; serviceConfig = { User = "numbus-admin"; Environment = [ "XDG_RUNTIME_DIR=/run/user/1000" ]; Type = "exec"; # Pull the latest image before running ExecStartPre = "${pkgs.podman-compose}/bin/podman-compose -f /etc/${compose_file} pull"; # Bring the service up ExecStart = "${pkgs.podman-compose}/bin/podman-compose -f /etc/${compose_file} up --remove-orphans"; # Take it down gracefully ExecStop = "${pkgs.podman-compose}/bin/podman-compose -f /etc/${compose_file} down"; Restart = "on-failure"; RestartSec = "10m"; StartLimitBurst = "3"; StartLimitIntervalSec = "30s"; }; }; }; }