From 3782b3b5d954c660abc3cad1d799edc033b61691 Mon Sep 17 00:00:00 2001 From: "Elliot Speck (Arcayr)" Date: Sun, 1 Oct 2023 04:53:02 +1100 Subject: [PATCH] nixos/virtualisation: add hostname option to oci-containers. --- nixos/modules/virtualisation/oci-containers.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix index a9f4ab77f866..a8448aba80f1 100644 --- a/nixos/modules/virtualisation/oci-containers.nix +++ b/nixos/modules/virtualisation/oci-containers.nix @@ -203,6 +203,13 @@ let ''; }; + hostname = mkOption { + type = with types; nullOr str; + default = null; + description = lib.mdDoc "The hostname of the container."; + example = "hello-world"; + }; + extraOptions = mkOption { type = with types; listOf str; default = []; @@ -266,6 +273,8 @@ let "--log-driver=${container.log-driver}" ] ++ optional (container.entrypoint != null) "--entrypoint=${escapeShellArg container.entrypoint}" + ++ optional (container.hostname != null) + "--hostname=${escapeShellArg container.hostname}" ++ lib.optionals (cfg.backend == "podman") [ "--cidfile=/run/podman-${escapedName}.ctr-id" "--cgroups=no-conmon"