organist
organist copied to clipboard
nix-shell: any way to access checks from flake.nix?
I'm trying to port my shell.nix to Nickel and I can't figure out how to use checks
from my flake.
{
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
'';
}
https://github.com/bbigras/nix-config/blob/e9531626e39a88a17c5aa888498418083b953243/nix/dev-shell.nix#L26-L28
My dev-shell.ncl so far is: https://github.com/bbigras/nix-config/blob/9cd66da961cd4e8a03b48d2a16a3318cc2d82604/nix/dev-shell.ncl
Looks like packages
(or legacyPackages
) is hardcoded here. It would be nice to make this a bit more generic (maybe replicating the search logic of Nix which also searches at the toplevel? Or just getting rid of this search logic at all maybe).
You can also probably work around it by hacking something like devShell = importNcl ./nix/dev-shell.ncl (inputs // { myChecks.packages = self.checks; };
, although that’s not really pretty 🙃