diff options
author | Sarah Brofeldt <sbrofeldt@gmail.com> | 2023-10-09 18:52:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 18:52:20 +0200 |
commit | a655e7a1aa2eeb9416ddc888c7815312e9b9d7c7 (patch) | |
tree | be335088fff50ccaeacedae36b56e85b7b0e1409 | |
parent | 7de5f5de5dd28de59e04c3de4f5b472fd4735240 (diff) | |
parent | 2f021def6e0a58e159e34b27b7796b2b5d0d0560 (diff) |
Merge pull request #259240 from haenoe/oci-containers-labels-option
nixos/oci-containers: add labels option
-rw-r--r-- | nixos/modules/virtualisation/oci-containers.nix | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix index a9f4ab77f866a..71f5d7a752c8c 100644 --- a/nixos/modules/virtualisation/oci-containers.nix +++ b/nixos/modules/virtualisation/oci-containers.nix @@ -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] |