···66 stringLength sub substring tail trace;
67 inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
68 bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
69- importJSON importTOML warn warnIf info showWarnings nixpkgsVersion version
070 mod compare splitByAndCompare functionArgs setFunctionArgs isFunction
71 toHexString toBaseDigits;
72 inherit (self.fixedPoints) fix fix' converge extends composeExtensions
···66 stringLength sub substring tail trace;
67 inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
68 bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
69+ importJSON importTOML warn warnIf throwIfNot
70+ info showWarnings nixpkgsVersion version
71 mod compare splitByAndCompare functionArgs setFunctionArgs isFunction
72 toHexString toBaseDigits;
73 inherit (self.fixedPoints) fix fix' converge extends composeExtensions
+22
lib/trivial.nix
···325 */
326 warnIf = cond: msg: if cond then warn msg else id;
3270000000000000000000000328 info = msg: builtins.trace "INFO: ${msg}";
329330 showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
···325 */
326 warnIf = cond: msg: if cond then warn msg else id;
327328+ /*
329+ Like the `assert b; e` expression, but with a custom error message and
330+ without the semicolon.
331+332+ If true, return the identity function, `r: r`.
333+334+ If false, throw the error message.
335+336+ Calls can be juxtaposed using function application, as `(r: r) a = a`, so
337+ `(r: r) (r: r) a = a`, and so forth.
338+339+ Type: bool -> string -> a -> a
340+341+ Example:
342+343+ throwIfNot (lib.isList overlays) "The overlays argument to nixpkgs must be a list."
344+ lib.foldr (x: throwIfNot (lib.isFunction x) "All overlays passed to nixpkgs must be functions.") (r: r) overlays
345+ pkgs
346+347+ */
348+ throwIfNot = cond: msg: if cond then x: x else throw msg;
349+350 info = msg: builtins.trace "INFO: ${msg}";
351352 showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
+10-1
pkgs/top-level/default.nix
···49in let
50 lib = import ../../lib;
5100000000052 localSystem = lib.systems.elaborate args.localSystem;
5354 # Condition preserves sharing which in turn affects equality.
···121122 pkgs = boot stages;
123124-in pkgs
···49in let
50 lib = import ../../lib;
5152+ inherit (lib) throwIfNot;
53+54+ checked =
55+ throwIfNot (lib.isList overlays) "The overlays argument to nixpkgs must be a list."
56+ lib.foldr (x: throwIfNot (lib.isFunction x) "All overlays passed to nixpkgs must be functions.") (r: r) overlays
57+ throwIfNot (lib.isList crossOverlays) "The crossOverlays argument to nixpkgs must be a list."
58+ lib.foldr (x: throwIfNot (lib.isFunction x) "All crossOverlays passed to nixpkgs must be functions.") (r: r) crossOverlays
59+ ;
60+61 localSystem = lib.systems.elaborate args.localSystem;
6263 # Condition preserves sharing which in turn affects equality.
···130131 pkgs = boot stages;
132133+in checked pkgs