msfjarvis / msfjarvis.dev

Hugo source for my blog
https://msfjarvis.dev
8 stars 3 forks source link

posts/writing-your-own-nix-flake-checks/ #61

Open utterances-bot opened 11 months ago

utterances-bot commented 11 months ago

Writing your own Nix Flake checks | Harsh Shandilya

Quick how-to for writing ad-hoc checks for your own Nix Flakes

https://msfjarvis.dev/posts/writing-your-own-nix-flake-checks/

Smaug123 commented 11 months ago

Thanks for this - I think you might be missing doCheck = true? My reading of https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase is that the check phase is skipped unless you explicitly set doCheck.

msfjarvis commented 11 months ago

Thanks for this - I think you might be missing doCheck = true? My reading of https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase is that the check phase is skipped unless you explicitly set doCheck.

To my knowledge if a derivation is passed to the checks output it's check phase is run unconditionally, otherwise yes you're correct about doCheck for regular derivations.

antifuchs commented 9 months ago

I stumbled across this too, and from https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase (and the behavior I observed), I'm pretty sure that doCheck is false by default:

doCheck Controls whether the check phase is executed. By default it is skipped, but if doCheck is set to true, the check phase is usually executed.

msfjarvis commented 9 months ago

Finally had the opportunity to test this, I don't know what drove my misconception but the doCheck is definitely required, I've amended the code examples. Thanks for the corrections folks!