1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

nixos/oci-containers: add preRunExtraOptions (#315356)

`podman --help` and `docker --help` each have global options, that
must be specified before `run`.
This commit is contained in:
tomf 2024-06-06 08:18:37 +10:00 committed by GitHub
parent 1d6a7e4e59
commit b2b3f5d68d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -221,6 +221,13 @@ let
example = "hello-world";
};
preRunExtraOptions = mkOption {
type = with types; listOf str;
default = [];
description = "Extra options for {command}`${defaultBackend}` that go before the `run` argument.";
example = [ "--runtime" "runsc" ];
};
extraOptions = mkOption {
type = with types; listOf str;
default = [];
@ -284,7 +291,9 @@ let
else throw "Unhandled backend: ${cfg.backend}";
script = concatStringsSep " \\\n " ([
"exec ${cfg.backend} run"
"exec ${cfg.backend} "
] ++ map escapeShellArg container.preRunExtraOptions ++ [
"run"
"--rm"
"--name=${escapedName}"
"--log-driver=${container.log-driver}"