diff options
author | Robert Hensing <robert@roberthensing.nl> | 2021-12-22 12:52:06 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2021-12-22 13:13:16 +0100 |
commit | cf73196411928e1dfc6784a8a1c67a467533af4c (patch) | |
tree | 377d7d1520870646c95d7f1cbe0efdc28de75e15 /pkgs/top-level/default.nix | |
parent | d4c6319803ecfa09d86b8e136722fad7566675d6 (diff) | |
download | nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.tar nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.tar.gz nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.tar.bz2 nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.tar.lz nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.tar.xz nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.tar.zst nixlib-cf73196411928e1dfc6784a8a1c67a467533af4c.zip |
nixpkgs: Check overlays types
This seems to be a common mistake and is worth checking so we can provide a better error message.
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r-- | pkgs/top-level/default.nix | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 10cf36d4d13e..10d0c79b2129 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -49,6 +49,15 @@ let # Rename the function arguments in let lib = import ../../lib; + throwIfNot = b: msg: if b then x: x else throw msg; + + checked = + throwIfNot (lib.isList overlays) "The overlays argument to nixpkgs must be a list." + lib.foldr (x: throwIfNot (lib.isFunction x) "All overlays passed to nixpkgs must be functions.") (r: r) overlays + throwIfNot (lib.isList crossOverlays) "The crossOverlays argument to nixpkgs must be a list." + lib.foldr (x: throwIfNot (lib.isFunction x) "All crossOverlays passed to nixpkgs must be functions.") (r: r) crossOverlays + ; + localSystem = lib.systems.elaborate args.localSystem; # Condition preserves sharing which in turn affects equality. @@ -121,4 +130,4 @@ in let pkgs = boot stages; -in pkgs +in checked pkgs |