cachix/git-hooks.nix

Example for Flake without `flake-parts`

Closed this issue · 1 comments

Would it be possible for you to provide an example of using these pre-commit hooks without flake-parts for a flake?

All attempts I've tried end up with the error 'builtins.storePath' is not allowed in pure evaluation mode.

Thanks in advance.

Here's a rough example of something I've tried:

inputs = {
	...
	nix-precommit-hooks.url = "github:/cachix/pre-commit-hooks.nix";
};
outputs = {nix-precommit-hooks, ...}:
	let
		nix-precommit-hooks-lib = import nix-precommit-hooks;
		pre-commit-check = nix-precommit-hooks-lib.run {
			src = ./.;
			hooks = {
				....
			};
		};
	in {
		devShells.${system}.default = pkgs.mkShell {
			....
			shellHook = ''
			    ${pre-commit-check.shellHook}
			''
		};
	};

I'm an idiot - I see you have this in the README at the bottom.