mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-24 03:43:53 +03:00
Merge pull request #62712 from danbst/module-conflict-naming
NixOS module system: improve one of error messages
This commit is contained in:
commit
e718eb6243
@ -101,7 +101,7 @@ rec {
|
||||
mergeOneOption = loc: defs:
|
||||
if defs == [] then abort "This case should never happen."
|
||||
else if length defs != 1 then
|
||||
throw "The unique option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}."
|
||||
throw "The unique option `${showOption loc}' is defined multiple times, in:\n - ${concatStringsSep "\n - " (getFiles defs)}."
|
||||
else (head defs).value;
|
||||
|
||||
/* "Merge" option definitions by checking that they all have the same value. */
|
||||
|
@ -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 ];
|
||||
|
Loading…
Reference in New Issue
Block a user