mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 20:49:52 +03:00
Merge pull request #111033 from szlend/fix-oci-containers-service-depends
nixos/oci-containers: Remove dependency on system.path
This commit is contained in:
commit
d25c7c1450
@ -217,7 +217,7 @@ let
|
||||
environment = proxy_env;
|
||||
|
||||
path =
|
||||
if cfg.backend == "docker" then [ pkgs.docker ]
|
||||
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}";
|
||||
|
||||
@ -227,15 +227,11 @@ let
|
||||
${cfg.backend} load -i ${container.imageFile}
|
||||
''}
|
||||
'';
|
||||
postStop = "${cfg.backend} rm -f ${name} || true";
|
||||
|
||||
serviceConfig = {
|
||||
StandardOutput = "null";
|
||||
StandardError = "null";
|
||||
ExecStart = concatStringsSep " \\\n " ([
|
||||
"${config.system.path}/bin/${cfg.backend} run"
|
||||
script = concatStringsSep " \\\n " ([
|
||||
"exec ${cfg.backend} run"
|
||||
"--rm"
|
||||
"--name=${name}"
|
||||
"--name=${escapeShellArg name}"
|
||||
"--log-driver=${container.log-driver}"
|
||||
] ++ optional (container.entrypoint != null)
|
||||
"--entrypoint=${escapeShellArg container.entrypoint}"
|
||||
@ -249,7 +245,12 @@ let
|
||||
++ map escapeShellArg container.cmd
|
||||
);
|
||||
|
||||
ExecStop = ''${pkgs.bash}/bin/sh -c "[ $SERVICE_RESULT = success ] || ${cfg.backend} stop ${name}"'';
|
||||
preStop = "[ $SERVICE_RESULT = success ] || ${cfg.backend} stop ${name}";
|
||||
postStop = "${cfg.backend} rm -f ${name} || true";
|
||||
|
||||
serviceConfig = {
|
||||
StandardOutput = "null";
|
||||
StandardError = "null";
|
||||
|
||||
### There is no generalized way of supporting `reload` for docker
|
||||
### containers. Some containers may respond well to SIGHUP sent to their
|
||||
|
Loading…
Reference in New Issue
Block a user