diff options
author | Domen Kožar <domen@dev.si> | 2023-02-10 02:42:28 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 02:42:28 +0700 |
commit | 844a738b1f91ee21bc4e7df3710c1ba9235d3041 (patch) | |
tree | 3b63742c4c317767a4724f966f8a527a67732e30 /lib | |
parent | c257eba8e2cd34d9213ffc6f3c6a81ea9c313a62 (diff) | |
parent | fe734efc9c2c0a42b9c34dfd6280d82558744a06 (diff) | |
download | nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.tar nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.tar.gz nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.tar.bz2 nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.tar.lz nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.tar.xz nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.tar.zst nixpkgs-844a738b1f91ee21bc4e7df3710c1ba9235d3041.zip |
Merge pull request #215455 from domenkozar/module-errors
nixos: Improve module conflict error messages
Diffstat (limited to 'lib')
-rw-r--r-- | lib/options.nix | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/options.nix b/lib/options.nix index d14d209a834..5e8f4ca4bb9 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -36,6 +36,9 @@ let inherit (lib.types) mkOptionType ; + prioritySuggestion = '' + Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions. + ''; in rec { @@ -184,7 +187,7 @@ rec { if length defs == 1 then (head defs).value else assert length defs > 1; - throw "The option `${showOption loc}' is defined multiple times.\n${message}\nDefinition values:${showDefs defs}"; + throw "The option `${showOption loc}' is defined multiple times while it's expected to be unique.\n${message}\nDefinition values:${showDefs defs}\n${prioritySuggestion}"; /* "Merge" option definitions by checking that they all have the same value. */ mergeEqualOption = loc: defs: @@ -195,7 +198,7 @@ rec { else if length defs == 1 then (head defs).value else (foldl' (first: def: if def.value != first.value then - throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}" + throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}\n${prioritySuggestion}" else first) (head defs) (tail defs)).value; |