summaryrefslogtreecommitdiffstats
path: root/nixos/modules/virtualisation/containers.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2018-12-05 01:25:16 +0100
committerGitHub <noreply@github.com>2018-12-05 01:25:16 +0100
commit0834e98ece646a6468201d3069006fe9f2d931eb (patch)
tree26ea814bf1543c7c14b1e32152160f9cb1eb7e70 /nixos/modules/virtualisation/containers.nix
parent16f42b369474333091cf9a48955d08e5d4aa8233 (diff)
parentbf102825efa1deb8de1afca4ed7541c098f6b068 (diff)
Merge pull request #51393 from arianvp/container-names
nixos/containers: Add assertion for container name length
Diffstat (limited to 'nixos/modules/virtualisation/containers.nix')
-rw-r--r--nixos/modules/virtualisation/containers.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index 63801b24f228..3dd36f9b12e1 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -461,6 +461,16 @@ in
{ boot.isContainer = true;
networking.hostName = mkDefault name;
networking.useDHCP = false;
+ assertions = [
+ {
+ assertion = config.privateNetwork -> stringLength name < 12;
+ message = ''
+ Container name `${name}` is too long: When `privateNetwork` is enabled, container names can
+ not be longer than 11 characters, because the container's interface name is derived from it.
+ This might be fixed in the future. See https://github.com/NixOS/nixpkgs/issues/38509
+ '';
+ }
+ ];
};
in [ extraConfig ] ++ (map (x: x.value) defs);
prefix = [ "containers" name ];