···6666 stringLength sub substring tail trace;
6767 inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
6868 bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
6969- importJSON importTOML warn warnIf info showWarnings nixpkgsVersion version
6969+ importJSON importTOML warn warnIf throwIfNot
7070+ info showWarnings nixpkgsVersion version
7071 mod compare splitByAndCompare functionArgs setFunctionArgs isFunction
7172 toHexString toBaseDigits;
7273 inherit (self.fixedPoints) fix fix' converge extends composeExtensions
+22
lib/trivial.nix
···325325 */
326326 warnIf = cond: msg: if cond then warn msg else id;
327327328328+ /*
329329+ Like the `assert b; e` expression, but with a custom error message and
330330+ without the semicolon.
331331+332332+ If true, return the identity function, `r: r`.
333333+334334+ If false, throw the error message.
335335+336336+ Calls can be juxtaposed using function application, as `(r: r) a = a`, so
337337+ `(r: r) (r: r) a = a`, and so forth.
338338+339339+ Type: bool -> string -> a -> a
340340+341341+ Example:
342342+343343+ throwIfNot (lib.isList overlays) "The overlays argument to nixpkgs must be a list."
344344+ lib.foldr (x: throwIfNot (lib.isFunction x) "All overlays passed to nixpkgs must be functions.") (r: r) overlays
345345+ pkgs
346346+347347+ */
348348+ throwIfNot = cond: msg: if cond then x: x else throw msg;
349349+328350 info = msg: builtins.trace "INFO: ${msg}";
329351330352 showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
+10-1
pkgs/top-level/default.nix
···4949in let
5050 lib = import ../../lib;
51515252+ inherit (lib) throwIfNot;
5353+5454+ checked =
5555+ throwIfNot (lib.isList overlays) "The overlays argument to nixpkgs must be a list."
5656+ lib.foldr (x: throwIfNot (lib.isFunction x) "All overlays passed to nixpkgs must be functions.") (r: r) overlays
5757+ throwIfNot (lib.isList crossOverlays) "The crossOverlays argument to nixpkgs must be a list."
5858+ lib.foldr (x: throwIfNot (lib.isFunction x) "All crossOverlays passed to nixpkgs must be functions.") (r: r) crossOverlays
5959+ ;
6060+5261 localSystem = lib.systems.elaborate args.localSystem;
53625463 # Condition preserves sharing which in turn affects equality.
···121130122131 pkgs = boot stages;
123132124124-in pkgs
133133+in checked pkgs