summary refs log tree commit diff
diff options
context:
space:
mode:
authoradisbladis <adisbladis@gmail.com>2023-11-06 10:44:26 +1300
committerGitHub <noreply@github.com>2023-11-06 10:44:26 +1300
commita1592fb410e7a659c2ae43e1e9293fc10a99178e (patch)
tree41387195c3e32b431c5a460d7366893e05813a9e
parentd87836b33e5fcdf0b4f5a0d5c623d4a72ebf366d (diff)
parent3782b3b5d954c660abc3cad1d799edc033b61691 (diff)
downloadnixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.tar
nixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.tar.gz
nixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.tar.bz2
nixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.tar.lz
nixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.tar.xz
nixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.tar.zst
nixpkgs-a1592fb410e7a659c2ae43e1e9293fc10a99178e.zip
Merge pull request #258299 from Arcayr/virtualisation-hostname
nixos/virtualisation: add hostname option to oci-containers.
-rw-r--r--nixos/modules/virtualisation/oci-containers.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix
index 65e97d53724..4ee5b0badde 100644
--- a/nixos/modules/virtualisation/oci-containers.nix
+++ b/nixos/modules/virtualisation/oci-containers.nix
@@ -214,6 +214,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 = [];
@@ -280,6 +287,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"