organist icon indicating copy to clipboard operation
organist copied to clipboard

nix-shell: any way to access checks from flake.nix?

Open bbigras opened this issue 2 years ago • 1 comments

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

bbigras avatar Mar 17 '22 05:03 bbigras

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 🙃

thufschmitt avatar Mar 18 '22 12:03 thufschmitt