-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci.nix isBuildable fails on broken in-tree root packages #48
Comments
Also not sure how to preform this check efficiently. @infinisil any ideas? |
Hydra solves this by actually trying to instantiate all packages. If they fail to evaluate, it logs the error and continues to the next one. CI could make use of this too by using the hydra-eval-jobs command, which takes a hydra-compatible release.nix and returns a json of all the derivations that successfully instantiated or inspectable failures. |
We could use isBuildable = p: (builtins.tryEval (builtins.deepSeq p p)).success; But this, like the hydra script, catches every evaluation error. Is this something we want? Is the job of ci catching eval errors too or should it only build the packages? edit: nevermind the code above, deepseq is too much |
We also have https://github.com/nix-community/nix-eval-jobs now, which is derived from hydra's code. It could do the instantiation part |
Here's the current solution, that I implemented today thanks to the above helpful comments:
evaluatedPackages = builtins.map builtins.fromJSON (pkgs.lib.splitString "\n" (pkgs.lib.fileContents ./evaluations.json));
canEvaluate = p: elem: ( elem ? "attr" && (pkgs.lib.hasInfix p.pname elem.attr) && (! (elem ? "error")));
isBuildable = p: any (canEvaluate p) evaluatedPackages; Feedback would be appreciated, I can submit a PR if people are interested. I tried to make a derivation in |
Sounds like a good first step also I think we could use the the json-line output to stream into a ci runner and hence already start building while the rest is still evaluating:
The only thing we are missing from |
nix-eval-jobs can now check the cache state of a derivation like nix-build-uncached did before. |
I'm running into an issue in drewrisinger#133. Basically, I have a
default.nix
similar to:When I run
nix-build -A cacheOutputs ci.nix
, I always get an error b/c it's trying to buildleafpkg
(which has evidently made it intocacheOutputs
because it's not broken itself), even thoughrootpkg
is obviously broken. I think the issue is theisBuildable
check isn't comprehensive enough (i.e. it doesn't check dependencies).Proposed solutions:
false
if any dependencies are broken. I considered this, but I'm struggling to come up with a better expression thannur-packages-template/ci.nix
Line 18 in cc8c782
leafpkg
(in my case, about 10ish packages) as broken. Obviously a simpler solution, but it seems silly to do this when a future update could fixrootpkg
and then you need to manually unmark all leaf packages.The text was updated successfully, but these errors were encountered: