Merge pull request #258299 from Arcayr/virtualisation-hostname

nixos/virtualisation: add hostname option to oci-containers.
This commit is contained in:
adisbladis 2023-11-06 10:44:26 +13:00 committed by GitHub
commit a1592fb410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"