diff --git a/README.md b/README.md index 3c11ef1b..81aee2e2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Given the following `flake.nix` example: { description = "An example project."; - inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + inputs.pre-commit-hooks.url = "github:cachix/git-hooks.nix"; outputs = { self, nixpkgs, ... }@inputs: let @@ -82,7 +82,7 @@ nix develop ```nix let - nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master"); + nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/git-hooks.nix/tarball/master"); in { # Configured with the module options defined in `modules/pre-commit.nix`: pre-commit-check = nix-pre-commit-hooks.run { @@ -387,7 +387,7 @@ Example configuration: ```nix let - nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master"); + nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/git-hooks.nix/tarball/master"); in { pre-commit-check = nix-pre-commit-hooks.run { hooks = { diff --git a/flake-module.nix b/flake-module.nix index e01913fb..b4861df3 100644 --- a/flake-module.nix +++ b/flake-module.nix @@ -46,7 +46,7 @@ in }; default = { }; description = '' - The pre-commit-hooks.nix configuration. + The git-hooks.nix configuration. ''; }; installationScript = mkOption { diff --git a/modules/hooks.nix b/modules/hooks.nix index e61f3ee8..74f8ad12 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -1869,7 +1869,7 @@ in ## this gets into a NixOS release, the following code will be useless. lib.throwIf (hooks.checkmake.package == null) - "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." + "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." "${hooks.checkmake.package}/bin/checkmake"; }; check-added-large-files = @@ -2096,7 +2096,7 @@ in # need version >= 0.4.0 for the --from-stdin flag toolVersionCheck = lib.versionAtLeast convco.version "0.4.0"; in - 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." + 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." builtins.toString script; stages = [ "commit-msg" ]; @@ -2521,7 +2521,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol "$PRE_COMMIT_COMMIT_MSG_SOURCE" --commit-msg-file "$1" ''; in - 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." + 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." toString script; stages = [ "prepare-commit-msg" ]; @@ -2547,7 +2547,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol ## next NixOS release, the following code will become irrelevant. lib.throwIf (hooks.headache.package == null) - "The version of nixpkgs used by pre-commit-hooks.nix does not have `ocamlPackages.headache`. Please use a more recent version of nixpkgs." + "The version of nixpkgs used by git-hooks.nix does not have `ocamlPackages.headache`. Please use a more recent version of nixpkgs." "${hooks.headache.package}/bin/headache -h ${hooks.headache.settings.header-file}"; }; hindent = @@ -3002,7 +3002,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol ## useless. lib.throwIf (hooks.pre-commit-hook-ensure-sops.package == null) - "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." + "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." '' ${hooks.pre-commit-hook-ensure-sops.package}/bin/pre-commit-hook-ensure-sops ''; @@ -3401,7 +3401,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol ## useless. lib.throwIf (hooks.topiary.package == null) - "The version of nixpkgs used by pre-commit-hooks.nix does not have the `topiary` package. Please use a more recent version of nixpkgs." + "The version of nixpkgs used by git-hooks.nix does not have the `topiary` package. Please use a more recent version of nixpkgs." ( let topiary-inplace = pkgs.writeShellApplication { @@ -3498,7 +3498,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol entry = lib.throwIf (hooks.typstyle.package == null) - "The version of nixpkgs used by pre-commit-hooks.nix must contain typstyle" + "The version of nixpkgs used by git-hooks.nix must contain typstyle" "${hooks.typstyle.package}/bin/typstyle -i"; files = "\\.typ$"; }; diff --git a/modules/pre-commit.nix b/modules/pre-commit.nix index c8f98d58..8e937a91 100644 --- a/modules/pre-commit.nix +++ b/modules/pre-commit.nix @@ -45,7 +45,7 @@ let } '' { echo '# DO NOT MODIFY'; - echo '# This file was generated by pre-commit-hooks.nix'; + echo '# This file was generated by git-hooks.nix'; jq . <"$rawJSONPath" } >$out '' @@ -126,7 +126,7 @@ in `nix-pre-commit-hooks` comes with its own set of packages for this purpose. ''; defaultText = - lib.literalExpression or literalExample ''pre-commit-hooks.nix-pkgs.callPackage tools-dot-nix { inherit (pkgs) system; }''; + lib.literalExpression or literalExample ''git-hooks.nix-pkgs.callPackage tools-dot-nix { inherit (pkgs) system; }''; }; enabledPackages = mkOption { @@ -329,9 +329,9 @@ in export PATH=${cfg.package}/bin:$PATH if ! type -t git >/dev/null; then # This happens in pure shells, including lorri - echo 1>&2 "WARNING: pre-commit-hooks.nix: git command not found; skipping installation." + echo 1>&2 "WARNING: git-hooks.nix: git command not found; skipping installation." elif ! ${git}/bin/git rev-parse --git-dir &> /dev/null; then - echo 1>&2 "WARNING: pre-commit-hooks.nix: .git not found; skipping installation." + echo 1>&2 "WARNING: git-hooks.nix: .git not found; skipping installation." else GIT_WC=`${git}/bin/git rev-parse --show-toplevel` @@ -341,13 +341,13 @@ in if ! readlink "''${GIT_WC}/.pre-commit-config.yaml" >/dev/null \ || [[ $(readlink "''${GIT_WC}/.pre-commit-config.yaml") != ${configFile} ]]; then - echo 1>&2 "pre-commit-hooks.nix: updating $PWD repo" + echo 1>&2 "git-hooks.nix: updating $PWD repo" [ -L .pre-commit-config.yaml ] && unlink .pre-commit-config.yaml if [ -e "''${GIT_WC}/.pre-commit-config.yaml" ]; then - echo 1>&2 "pre-commit-hooks.nix: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml" + echo 1>&2 "git-hooks.nix: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml" echo 1>&2 " 1. Translate .pre-commit-config.yaml contents to the new syntax in your Nix file" - echo 1>&2 " see https://github.com/cachix/pre-commit-hooks.nix#getting-started" + echo 1>&2 " see https://github.com/cachix/git-hooks.nix#getting-started" echo 1>&2 " 2. remove .pre-commit-config.yaml" echo 1>&2 " 3. add .pre-commit-config.yaml to .gitignore" else @@ -373,7 +373,7 @@ in pre-commit install -t $stage ;; *) - 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." + echo 1>&2 "ERROR: git-hooks.nix: either $stage is not a valid stage or git-hooks.nix doesn't yet support it." exit 1 ;; esac diff --git a/template/flake.nix b/template/flake.nix index 384f3378..d569f9a7 100644 --- a/template/flake.nix +++ b/template/flake.nix @@ -3,9 +3,9 @@ inputs = { flake-parts.url = "github:hercules-ci/flake-parts"; + git-hooks-nix.inputs.nixpkgs.follows = "nixpkgs"; + git-hooks-nix.url = "github:cachix/git-hooks.nix"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix"; - pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs@{ self, flake-parts, ... }: @@ -13,7 +13,7 @@ { inherit inputs; } { imports = [ - inputs.pre-commit-hooks-nix.flakeModule + inputs.git-hooks-nix.flakeModule ]; systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; perSystem = { config, self', inputs', pkgs, ... }: {