mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
Merge pull request #151748 from hercules-ci/check-nixpkgs-overlays-type
Check nixpkgs overlays argument types
This commit is contained in:
commit
c253b04a2f
@ -66,7 +66,8 @@ let
|
|||||||
stringLength sub substring tail trace;
|
stringLength sub substring tail trace;
|
||||||
inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
|
inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
|
||||||
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
|
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
|
||||||
importJSON importTOML warn warnIf info showWarnings nixpkgsVersion version
|
importJSON importTOML warn warnIf throwIfNot
|
||||||
|
info showWarnings nixpkgsVersion version
|
||||||
mod compare splitByAndCompare functionArgs setFunctionArgs isFunction
|
mod compare splitByAndCompare functionArgs setFunctionArgs isFunction
|
||||||
toHexString toBaseDigits;
|
toHexString toBaseDigits;
|
||||||
inherit (self.fixedPoints) fix fix' converge extends composeExtensions
|
inherit (self.fixedPoints) fix fix' converge extends composeExtensions
|
||||||
|
@ -325,6 +325,28 @@ rec {
|
|||||||
*/
|
*/
|
||||||
warnIf = cond: msg: if cond then warn msg else id;
|
warnIf = cond: msg: if cond then warn msg else id;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Like the `assert b; e` expression, but with a custom error message and
|
||||||
|
without the semicolon.
|
||||||
|
|
||||||
|
If true, return the identity function, `r: r`.
|
||||||
|
|
||||||
|
If false, throw the error message.
|
||||||
|
|
||||||
|
Calls can be juxtaposed using function application, as `(r: r) a = a`, so
|
||||||
|
`(r: r) (r: r) a = a`, and so forth.
|
||||||
|
|
||||||
|
Type: bool -> string -> a -> a
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
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
|
||||||
|
pkgs
|
||||||
|
|
||||||
|
*/
|
||||||
|
throwIfNot = cond: msg: if cond then x: x else throw msg;
|
||||||
|
|
||||||
info = msg: builtins.trace "INFO: ${msg}";
|
info = msg: builtins.trace "INFO: ${msg}";
|
||||||
|
|
||||||
showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
|
showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
|
||||||
|
@ -49,6 +49,15 @@ let # Rename the function arguments
|
|||||||
in let
|
in let
|
||||||
lib = import ../../lib;
|
lib = import ../../lib;
|
||||||
|
|
||||||
|
inherit (lib) throwIfNot;
|
||||||
|
|
||||||
|
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;
|
localSystem = lib.systems.elaborate args.localSystem;
|
||||||
|
|
||||||
# Condition preserves sharing which in turn affects equality.
|
# Condition preserves sharing which in turn affects equality.
|
||||||
@ -121,4 +130,4 @@ in let
|
|||||||
|
|
||||||
pkgs = boot stages;
|
pkgs = boot stages;
|
||||||
|
|
||||||
in pkgs
|
in checked pkgs
|
||||||
|
Loading…
Reference in New Issue
Block a user