Skip to content

Commit

Permalink
test: fix meta.broken detection (again)
Browse files Browse the repository at this point in the history
meta.broken will haunt me forever.
  • Loading branch information
hraban committed Oct 16, 2023
1 parent 6bc1dbd commit 7ef111f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 2 additions & 3 deletions examples/channels/all-packages-wrapped/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ with pkgs.lib;
with rec {
lispPackagesLite = pkgs.lispPackagesLiteFor (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}");
isSafeLisp = d: let
ev = builtins.tryEval d;
d' = ev.value;
in ev.success && (isDerivation d') && !(d'.meta.broken or false);
ev = builtins.tryEval (isDerivation d && !(d.meta.broken or false));
in ev.success && ev.value;
};

lispPackagesLite.lispWithSystems (
Expand Down
5 changes: 2 additions & 3 deletions examples/channels/all-packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ with rec {
# Compiling Shinmera/3d-math requires a lot of memory, might as well grant it
lispPackagesLite = pkgs.lispPackagesLiteFor (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}");
isSafeLisp = d: let
ev = builtins.tryEval d;
d' = ev.value;
in ev.success && (isDerivation d') && !(d'.meta.broken or false);
ev = builtins.tryEval (isDerivation d && !(d.meta.broken or false));
in ev.success && ev.value;
};

attrsets.filterAttrs (_: isSafeLisp) lispPackagesLite
19 changes: 14 additions & 5 deletions examples/channels/test-all/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,22 @@ with rec {
# it
lispPackagesLite = pkgs.lispPackagesLiteFor (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}");
isSafeLisp = d: let
ev = builtins.tryEval d;
d' = ev.value;
in ev.success && (isDerivation d') && !(d'.meta.broken or false);
ev = builtins.tryEval (isDerivation d && !(d.meta.broken or false));
in ev.success && ev.value;
shouldTest = name: ! builtins.elem name skip;
};

pipe lispPackagesLite [
(attrsets.filterAttrs (n: d: (isSafeLisp d) && (shouldTest n)))
(builtins.mapAttrs (k: v: v.enableCheck))
(builtins.mapAttrs (name: value: let
ev = builtins.tryEval (let
d = value.enableCheck;
in
if shouldTest name && isDerivation value && !(d.meta.broken or false)
then d
else null);
in
if ev.success && ev.value != null
then ev.value
else null))
(attrsets.filterAttrs (n: d: d != null))
]

0 comments on commit 7ef111f

Please sign in to comment.