mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
[Lib/Derivations] init with isBroken helper
Returns true if the parameter is not a derivation or if trying to evaluate the derivation would fail.
This commit is contained in:
parent
1387a101e6
commit
8f4c49f955
2 changed files with 16 additions and 0 deletions
|
|
@ -12,5 +12,6 @@ let
|
|||
attrsets = callLibs ./attrsets.nix;
|
||||
types = callLibs ./types.nix;
|
||||
debug = callLibs ./debug.nix;
|
||||
derivations = callLibs ./derivations.nix;
|
||||
});
|
||||
in myLib
|
||||
|
|
|
|||
15
lib/derivations.nix
Normal file
15
lib/derivations.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{lib, myLib, ...}:
|
||||
with lib;
|
||||
rec {
|
||||
isBroken = x:
|
||||
let
|
||||
tryX = builtins.tryEval x;
|
||||
in
|
||||
if
|
||||
tryX.success && (isDerivation tryX.value)
|
||||
then
|
||||
tryX.value.meta.insecure || tryX.value.meta.broken
|
||||
else
|
||||
true
|
||||
;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue