nixos/oci-containers: add labels option
This commit is contained in:
parent
99515b5c50
commit
2f021def6e
1 changed files with 12 additions and 0 deletions
|
@ -66,6 +66,17 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
labels = mkOption {
|
||||||
|
type = with types; attrsOf str;
|
||||||
|
default = {};
|
||||||
|
description = lib.mdDoc "Labels to attach to the container at runtime.";
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
"traefik.https.routers.example.rule" = "Host(`example.container`)";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
entrypoint = mkOption {
|
entrypoint = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
description = lib.mdDoc "Override the default entrypoint of the image.";
|
description = lib.mdDoc "Override the default entrypoint of the image.";
|
||||||
|
@ -277,6 +288,7 @@ let
|
||||||
++ map (p: "-p ${escapeShellArg p}") container.ports
|
++ map (p: "-p ${escapeShellArg p}") container.ports
|
||||||
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
|
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
|
||||||
++ map (v: "-v ${escapeShellArg v}") container.volumes
|
++ map (v: "-v ${escapeShellArg v}") container.volumes
|
||||||
|
++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels)
|
||||||
++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
|
++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
|
||||||
++ map escapeShellArg container.extraOptions
|
++ map escapeShellArg container.extraOptions
|
||||||
++ [container.image]
|
++ [container.image]
|
||||||
|
|
Loading…
Reference in a new issue