Skip to content

Commit c8a5405

Browse files
authored
Merge pull request #488 from trueNAHO/docs-rename-pre-commit-hooks-nix-repository-to-git-hooks-nix
docs: rename `pre-commit-hooks.nix` instances to `git-hooks.nix`
2 parents 6cedaa7 + c08fc07 commit c8a5405

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Given the following `flake.nix` example:
2727
{
2828
description = "An example project.";
2929
30-
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
30+
inputs.pre-commit-hooks.url = "github:cachix/git-hooks.nix";
3131
3232
outputs = { self, nixpkgs, ... }@inputs:
3333
let
@@ -82,7 +82,7 @@ nix develop
8282

8383
```nix
8484
let
85-
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
85+
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/git-hooks.nix/tarball/master");
8686
in {
8787
# Configured with the module options defined in `modules/pre-commit.nix`:
8888
pre-commit-check = nix-pre-commit-hooks.run {
@@ -387,7 +387,7 @@ Example configuration:
387387

388388
```nix
389389
let
390-
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
390+
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/git-hooks.nix/tarball/master");
391391
in {
392392
pre-commit-check = nix-pre-commit-hooks.run {
393393
hooks = {

flake-module.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ in
4646
};
4747
default = { };
4848
description = ''
49-
The pre-commit-hooks.nix configuration.
49+
The git-hooks.nix configuration.
5050
'';
5151
};
5252
installationScript = mkOption {

modules/hooks.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ in
18691869
## this gets into a NixOS release, the following code will be useless.
18701870
lib.throwIf
18711871
(hooks.checkmake.package == null)
1872-
"The version of nixpkgs used by pre-commit-hooks.nix must have `checkmake` in version at least 0.2.2 for it to work on non-Linux systems."
1872+
"The version of nixpkgs used by git-hooks.nix must have `checkmake` in version at least 0.2.2 for it to work on non-Linux systems."
18731873
"${hooks.checkmake.package}/bin/checkmake";
18741874
};
18751875
check-added-large-files =
@@ -2096,7 +2096,7 @@ in
20962096
# need version >= 0.4.0 for the --from-stdin flag
20972097
toolVersionCheck = lib.versionAtLeast convco.version "0.4.0";
20982098
in
2099-
lib.throwIf (convco == null || !toolVersionCheck) "The version of Nixpkgs used by pre-commit-hooks.nix does not have the `convco` package (>=0.4.0). Please use a more recent version of Nixpkgs."
2099+
lib.throwIf (convco == null || !toolVersionCheck) "The version of Nixpkgs used by git-hooks.nix does not have the `convco` package (>=0.4.0). Please use a more recent version of Nixpkgs."
21002100
builtins.toString
21012101
script;
21022102
stages = [ "commit-msg" ];
@@ -2521,7 +2521,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
25212521
"$PRE_COMMIT_COMMIT_MSG_SOURCE" --commit-msg-file "$1"
25222522
'';
25232523
in
2524-
lib.throwIf (hooks.gptcommit.package == null) "The version of Nixpkgs used by pre-commit-hooks.nix does not have the `gptcommit` package. Please use a more recent version of Nixpkgs."
2524+
lib.throwIf (hooks.gptcommit.package == null) "The version of Nixpkgs used by git-hooks.nix does not have the `gptcommit` package. Please use a more recent version of Nixpkgs."
25252525
toString
25262526
script;
25272527
stages = [ "prepare-commit-msg" ];
@@ -2547,7 +2547,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
25472547
## next NixOS release, the following code will become irrelevant.
25482548
lib.throwIf
25492549
(hooks.headache.package == null)
2550-
"The version of nixpkgs used by pre-commit-hooks.nix does not have `ocamlPackages.headache`. Please use a more recent version of nixpkgs."
2550+
"The version of nixpkgs used by git-hooks.nix does not have `ocamlPackages.headache`. Please use a more recent version of nixpkgs."
25512551
"${hooks.headache.package}/bin/headache -h ${hooks.headache.settings.header-file}";
25522552
};
25532553
hindent =
@@ -3002,7 +3002,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
30023002
## useless.
30033003
lib.throwIf
30043004
(hooks.pre-commit-hook-ensure-sops.package == null)
3005-
"The version of nixpkgs used by pre-commit-hooks.nix does not have the `pre-commit-hook-ensure-sops` package. Please use a more recent version of nixpkgs."
3005+
"The version of nixpkgs used by git-hooks.nix does not have the `pre-commit-hook-ensure-sops` package. Please use a more recent version of nixpkgs."
30063006
''
30073007
${hooks.pre-commit-hook-ensure-sops.package}/bin/pre-commit-hook-ensure-sops
30083008
'';
@@ -3401,7 +3401,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
34013401
## useless.
34023402
lib.throwIf
34033403
(hooks.topiary.package == null)
3404-
"The version of nixpkgs used by pre-commit-hooks.nix does not have the `topiary` package. Please use a more recent version of nixpkgs."
3404+
"The version of nixpkgs used by git-hooks.nix does not have the `topiary` package. Please use a more recent version of nixpkgs."
34053405
(
34063406
let
34073407
topiary-inplace = pkgs.writeShellApplication {
@@ -3498,7 +3498,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
34983498
entry =
34993499
lib.throwIf
35003500
(hooks.typstyle.package == null)
3501-
"The version of nixpkgs used by pre-commit-hooks.nix must contain typstyle"
3501+
"The version of nixpkgs used by git-hooks.nix must contain typstyle"
35023502
"${hooks.typstyle.package}/bin/typstyle -i";
35033503
files = "\\.typ$";
35043504
};

modules/pre-commit.nix

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let
4545
} ''
4646
{
4747
echo '# DO NOT MODIFY';
48-
echo '# This file was generated by pre-commit-hooks.nix';
48+
echo '# This file was generated by git-hooks.nix';
4949
jq . <"$rawJSONPath"
5050
} >$out
5151
''
@@ -126,7 +126,7 @@ in
126126
`nix-pre-commit-hooks` comes with its own set of packages for this purpose.
127127
'';
128128
defaultText =
129-
lib.literalExpression or literalExample ''pre-commit-hooks.nix-pkgs.callPackage tools-dot-nix { inherit (pkgs) system; }'';
129+
lib.literalExpression or literalExample ''git-hooks.nix-pkgs.callPackage tools-dot-nix { inherit (pkgs) system; }'';
130130
};
131131

132132
enabledPackages = mkOption {
@@ -329,9 +329,9 @@ in
329329
export PATH=${cfg.package}/bin:$PATH
330330
if ! type -t git >/dev/null; then
331331
# This happens in pure shells, including lorri
332-
echo 1>&2 "WARNING: pre-commit-hooks.nix: git command not found; skipping installation."
332+
echo 1>&2 "WARNING: git-hooks.nix: git command not found; skipping installation."
333333
elif ! ${git}/bin/git rev-parse --git-dir &> /dev/null; then
334-
echo 1>&2 "WARNING: pre-commit-hooks.nix: .git not found; skipping installation."
334+
echo 1>&2 "WARNING: git-hooks.nix: .git not found; skipping installation."
335335
else
336336
GIT_WC=`${git}/bin/git rev-parse --show-toplevel`
337337
@@ -341,13 +341,13 @@ in
341341
342342
if ! readlink "''${GIT_WC}/.pre-commit-config.yaml" >/dev/null \
343343
|| [[ $(readlink "''${GIT_WC}/.pre-commit-config.yaml") != ${configFile} ]]; then
344-
echo 1>&2 "pre-commit-hooks.nix: updating $PWD repo"
344+
echo 1>&2 "git-hooks.nix: updating $PWD repo"
345345
[ -L .pre-commit-config.yaml ] && unlink .pre-commit-config.yaml
346346
347347
if [ -e "''${GIT_WC}/.pre-commit-config.yaml" ]; then
348-
echo 1>&2 "pre-commit-hooks.nix: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml"
348+
echo 1>&2 "git-hooks.nix: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml"
349349
echo 1>&2 " 1. Translate .pre-commit-config.yaml contents to the new syntax in your Nix file"
350-
echo 1>&2 " see https://github.com/cachix/pre-commit-hooks.nix#getting-started"
350+
echo 1>&2 " see https://github.com/cachix/git-hooks.nix#getting-started"
351351
echo 1>&2 " 2. remove .pre-commit-config.yaml"
352352
echo 1>&2 " 3. add .pre-commit-config.yaml to .gitignore"
353353
else
@@ -373,7 +373,7 @@ in
373373
pre-commit install -t $stage
374374
;;
375375
*)
376-
echo 1>&2 "ERROR: pre-commit-hooks.nix: either $stage is not a valid stage or pre-commit-hooks.nix doesn't yet support it."
376+
echo 1>&2 "ERROR: git-hooks.nix: either $stage is not a valid stage or git-hooks.nix doesn't yet support it."
377377
exit 1
378378
;;
379379
esac

template/flake.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
inputs = {
55
flake-parts.url = "github:hercules-ci/flake-parts";
6+
git-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
7+
git-hooks-nix.url = "github:cachix/git-hooks.nix";
68
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
7-
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
8-
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
99
};
1010

1111
outputs = inputs@{ self, flake-parts, ... }:
1212
flake-parts.lib.mkFlake
1313
{ inherit inputs; }
1414
{
1515
imports = [
16-
inputs.pre-commit-hooks-nix.flakeModule
16+
inputs.git-hooks-nix.flakeModule
1717
];
1818
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
1919
perSystem = { config, self', inputs', pkgs, ... }: {

0 commit comments

Comments
 (0)