0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

Merge pull request #259240 from haenoe/oci-containers-labels-option

nixos/oci-containers: add labels option
This commit is contained in:
Sarah Brofeldt 2023-10-09 18:52:20 +02:00 committed by GitHub
commit a655e7a1aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {
type = with types; nullOr str;
description = lib.mdDoc "Override the default entrypoint of the image.";
@ -277,6 +288,7 @@ let
++ map (p: "-p ${escapeShellArg p}") container.ports
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
++ 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}"
++ map escapeShellArg container.extraOptions
++ [container.image]