diff options
author | Danylo Hlynskyi <abcz2.uprola@gmail.com> | 2019-06-13 11:59:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-13 11:59:54 +0300 |
commit | e718eb624301cbf1147970701ca525573bd6fc1d (patch) | |
tree | 185e48c3ed3f21f89f73333f525cfa0b6831245b /nixos/modules/virtualisation/containers.nix | |
parent | 8c912d4e471ec46dac2b6806fd282c57f47cba31 (diff) | |
parent | f7940bb95d1b88f17fb42cc13b98b660cec8aee4 (diff) | |
download | nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.tar nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.tar.gz nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.tar.bz2 nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.tar.lz nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.tar.xz nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.tar.zst nixpkgs-e718eb624301cbf1147970701ca525573bd6fc1d.zip |
Merge pull request #62712 from danbst/module-conflict-naming
NixOS module system: improve one of error messages
Diffstat (limited to 'nixos/modules/virtualisation/containers.nix')
-rw-r--r-- | nixos/modules/virtualisation/containers.nix | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index 97243e3304e..2235eec9d95 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -465,20 +465,24 @@ in merge = loc: defs: (import ../../lib/eval-config.nix { inherit system; modules = - let extraConfig = - { 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 - ''; - } - ]; + let + extraConfig = { + _file = "module at ${__curPos.file}:${toString __curPos.line}"; + config = { + 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 ]; |