feat(run.nix): expose more#512
Conversation
744add8 to
c93e347
Compare
Does a checks.git-hooks = inputs.git-hooks.lib.${system}.run {};
apps.default = self.checks.${system}.git-hooks;However, I agree that being able to access the internal For example, my LaTeX flake requires me to wrap checks.git-hooks = inputs.git-hooks.lib.${system}.run {
hooks.latexindent = {
enable = true;
entry = lib.getExe (
pkgs.writeShellApplication {
name = "git-hooks-latexindent-entry";
text = ''
${
lib.getExe'
(
# Re-implement and re-evaluate hooks.latexindent.package.
pkgs.texlive.combine {
inherit (pkgs.texlive) latexindent scheme-minimal;
}
)
"latexindent"
} ${
lib.cli.toGNUCommandLineShell {} {
logfile = toString /dev/null;
overwriteIfDifferent = true;
silent = true;
}
} --cruft "$(mktemp --directory)" "$@"
'';
}
);
};
src = ./.;
};Accessing the package through something like |
Not really. This would just avoid running all checks and would allow formatters to apply changes, but I like to run certain hooks, e.g. |
With this PR, the derivation returned by
git-hooks.lib.${system}.run { … }contains the attributeconfig, which can be used to get the configured pre-commit-hooks. I.e. t is now possible to use the result both in the flake-outputs as e.g.checks = { inherit pre-commit-hooks; };as well asapps = fooBar pre-commit-hooks.config.hooks, wherefooBarextracts all entries of enabled hooks so e.g.nix run clippywould be possible using the same CLI-options as thechecks.pre-commit-hooks.If there already was a way to access these processed hooks, please document it, because I could not find a way myself.