diff --git a/builtin-modules/pre-commit-hook.nix b/builtin-modules/pre-commit-hook.nix index 0cd21b6..8b0e48c 100644 --- a/builtin-modules/pre-commit-hook.nix +++ b/builtin-modules/pre-commit-hook.nix @@ -3,7 +3,7 @@ _: { if [ -f flake.nix ] && [ -d .git/hooks ] && [ ! -f .git/hooks/pre-commit ]; then echo Installing git pre-commit hook... - cp ${lib.getExe flakelite.inputs'.flakelite.packages.pre-commit + cp ${lib.getExe flakelite.inputs'.flakelite.packages.pre-commit-hook } .git/hooks fi ''; diff --git a/packages/pre-commit b/packages/pre-commit deleted file mode 100644 index 1ad3292..0000000 --- a/packages/pre-commit +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -TREE=$(mktemp -d) -git archive "$(git write-tree)" | tar -xC "$TREE" -nix flake check "$TREE" diff --git a/packages/pre-commit.nix b/packages/pre-commit-hook.nix similarity index 52% rename from packages/pre-commit.nix rename to packages/pre-commit-hook.nix index af580c6..7250e39 100644 --- a/packages/pre-commit.nix +++ b/packages/pre-commit-hook.nix @@ -6,5 +6,9 @@ writeShellApplication { name = "pre-commit"; runtimeInputs = [ nix git gnutar ]; - text = builtins.readFile ./pre-commit; + text = '' + TREE=$(mktemp -d) + git archive "$(git write-tree)" | tar -xC "$TREE" + nix flake check "$TREE" + ''; }