Merge pull request #51393 from arianvp/container-names

nixos/containers: Add assertion for container name length
This commit is contained in:
Florian Klink 2018-12-05 01:25:16 +01:00 committed by GitHub
commit 0834e98ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 ];