Loading nixos/modules/virtualisation/oci-containers.nix +21 −18 Original line number Diff line number Diff line Loading @@ -239,21 +239,10 @@ let mkService = name: container: let dependsOn = map (x: "${cfg.backend}-${x}.service") container.dependsOn; escapedName = escapeShellArg name; in { wantedBy = [] ++ optional (container.autoStart) "multi-user.target"; after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ] # if imageFile is not set, the service needs the network to download the image from the registry ++ lib.optionals (container.imageFile == null) [ "network-online.target" ] ++ dependsOn; requires = dependsOn; environment = proxy_env; path = if cfg.backend == "docker" then [ config.virtualisation.docker.package ] else if cfg.backend == "podman" then [ config.virtualisation.podman.package ] else throw "Unhandled backend: ${cfg.backend}"; preStart = '' preStartScript = pkgs.writeShellApplication { name = "pre-start"; runtimeInputs = [ ]; text = '' ${cfg.backend} rm -f ${name} || true ${optionalString (isValidLogin container.login) '' cat ${container.login.passwordFile} | \ Loading @@ -269,6 +258,20 @@ let rm -f /run/podman-${escapedName}.ctr-id ''} ''; }; in { wantedBy = [] ++ optional (container.autoStart) "multi-user.target"; after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ] # if imageFile is not set, the service needs the network to download the image from the registry ++ lib.optionals (container.imageFile == null) [ "network-online.target" ] ++ dependsOn; requires = dependsOn; environment = proxy_env; path = if cfg.backend == "docker" then [ config.virtualisation.docker.package ] else if cfg.backend == "podman" then [ config.virtualisation.podman.package ] else throw "Unhandled backend: ${cfg.backend}"; script = concatStringsSep " \\\n " ([ "exec ${cfg.backend} run" Loading Loading @@ -318,7 +321,7 @@ let ### # ExecReload = ...; ### ExecStartPre = [ "${preStartScript}/bin/pre-start" ]; TimeoutStartSec = 0; TimeoutStopSec = 120; Restart = "always"; Loading Loading
nixos/modules/virtualisation/oci-containers.nix +21 −18 Original line number Diff line number Diff line Loading @@ -239,21 +239,10 @@ let mkService = name: container: let dependsOn = map (x: "${cfg.backend}-${x}.service") container.dependsOn; escapedName = escapeShellArg name; in { wantedBy = [] ++ optional (container.autoStart) "multi-user.target"; after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ] # if imageFile is not set, the service needs the network to download the image from the registry ++ lib.optionals (container.imageFile == null) [ "network-online.target" ] ++ dependsOn; requires = dependsOn; environment = proxy_env; path = if cfg.backend == "docker" then [ config.virtualisation.docker.package ] else if cfg.backend == "podman" then [ config.virtualisation.podman.package ] else throw "Unhandled backend: ${cfg.backend}"; preStart = '' preStartScript = pkgs.writeShellApplication { name = "pre-start"; runtimeInputs = [ ]; text = '' ${cfg.backend} rm -f ${name} || true ${optionalString (isValidLogin container.login) '' cat ${container.login.passwordFile} | \ Loading @@ -269,6 +258,20 @@ let rm -f /run/podman-${escapedName}.ctr-id ''} ''; }; in { wantedBy = [] ++ optional (container.autoStart) "multi-user.target"; after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ] # if imageFile is not set, the service needs the network to download the image from the registry ++ lib.optionals (container.imageFile == null) [ "network-online.target" ] ++ dependsOn; requires = dependsOn; environment = proxy_env; path = if cfg.backend == "docker" then [ config.virtualisation.docker.package ] else if cfg.backend == "podman" then [ config.virtualisation.podman.package ] else throw "Unhandled backend: ${cfg.backend}"; script = concatStringsSep " \\\n " ([ "exec ${cfg.backend} run" Loading Loading @@ -318,7 +321,7 @@ let ### # ExecReload = ...; ### ExecStartPre = [ "${preStartScript}/bin/pre-start" ]; TimeoutStartSec = 0; TimeoutStopSec = 120; Restart = "always"; Loading