From 934e851ed18119ec7fd3ab7a555c35d985941078 Mon Sep 17 00:00:00 2001 From: Sander Date: Mon, 4 Nov 2024 15:15:49 +0400 Subject: [PATCH] pre-commit: rename more uses --- .github/workflows/generate.yml | 4 ++-- _redirects | 1 - docs/guides/using-with-flakes.md | 4 ++-- docs/integrations/github-actions.md | 2 +- docs/overrides/home.html | 2 +- examples/go/devenv.nix | 2 +- examples/modern-c/devenv.nix | 4 ++-- examples/rust-wasm-cross/devenv.nix | 3 ++- examples/rust/devenv.nix | 8 ++++---- src/modules/languages/rust.nix | 6 +++--- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index ff1f1f853..6a9c05fd4 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -22,9 +22,9 @@ jobs: - name: Install devenv run: nix profile install . -L --accept-flake-config - - name: Disable pre-commit hooks + - name: Disable git-hooks run: | - echo '{ pre-commit.default_stages = ["manual"]; }' > devenv.local.nix + echo '{ git-hooks.default_stages = ["manual"]; }' > devenv.local.nix - name: Generate doc options run: devenv shell devenv-generate-doc-options diff --git a/_redirects b/_redirects index 276e4806f..38df8b350 100644 --- a/_redirects +++ b/_redirects @@ -1,4 +1,3 @@ /blog/2023/03/20/devenv-10-rewrite-in-rust/ /blog/2024/03/20/devenv-10-rewrite-in-rust/ 301 /blog/2024/10/22/devenv-is-switching-nix-implementation-to-tvix/ /blog/2024/10/22/devenv-is-switching-its-nix-implementation-to-tvix/ 301 /pre-commit-hooks/ /git-hooks/ 301 - diff --git a/docs/guides/using-with-flakes.md b/docs/guides/using-with-flakes.md index 289b6b62f..49964beec 100644 --- a/docs/guides/using-with-flakes.md +++ b/docs/guides/using-with-flakes.md @@ -97,12 +97,12 @@ And run [tests with `devenv test`](/tests). ```console $ devenv test Running tasks devenv:enterShell -Succeeded devenv:pre-commit:install 10ms +Succeeded devenv:git-hooks:install 10ms Succeeded devenv:enterShell 4ms 2 Succeeded 14.75ms • Testing ... Running tasks devenv:enterTest -Succeeded devenv:pre-commit:run 474ms +Succeeded devenv:git-hooks:run 474ms Not implemented devenv:enterTest 1 Skipped, 1 Succeeded 474.62ms ``` diff --git a/docs/integrations/github-actions.md b/docs/integrations/github-actions.md index ed2694253..4724e4617 100644 --- a/docs/integrations/github-actions.md +++ b/docs/integrations/github-actions.md @@ -62,7 +62,7 @@ It builds the shell and runs any defined [git hooks](../git-hooks.md) against yo This is a quick and easy way to test that your development environment works as expected and lint your code at the same time. ```yaml -- name: Build the devenv shell and run any pre-commit hooks +- name: Build the devenv shell and run any git hooks run: devenv test ``` diff --git a/docs/overrides/home.html b/docs/overrides/home.html index 5bf2d2f6d..57078f6a9 100644 --- a/docs/overrides/home.html +++ b/docs/overrides/home.html @@ -183,7 +183,7 @@

Fast, Decla
devenv shell
 ...
 Running tasks     devenv:enterShell
-Succeeded         devenv:pre-commit:install 15ms
+Succeeded         devenv:git-hooks:install 15ms
 Succeeded         myapp:build               23ms
 Succeeded         devenv:enterShell         23ms
 3 Succeeded                                 50.14ms
diff --git a/examples/go/devenv.nix b/examples/go/devenv.nix
index 23ea6958c..253cbfadb 100644
--- a/examples/go/devenv.nix
+++ b/examples/go/devenv.nix
@@ -5,7 +5,7 @@
 
   languages.go.enable = true;
 
-  pre-commit.hooks = {
+  git-hooks.hooks = {
     govet = {
       enable = true;
       pass_filenames = false;
diff --git a/examples/modern-c/devenv.nix b/examples/modern-c/devenv.nix
index b50201b2c..85a34d3b7 100644
--- a/examples/modern-c/devenv.nix
+++ b/examples/modern-c/devenv.nix
@@ -7,8 +7,8 @@
     cmake --version
   '';
 
-  pre-commit.excludes = [ ".devenv" ];
-  pre-commit.hooks = {
+  git-hooks.excludes = [ ".devenv" ];
+  git-hooks.hooks = {
     clang-tidy.enable = true;
   };
 }
diff --git a/examples/rust-wasm-cross/devenv.nix b/examples/rust-wasm-cross/devenv.nix
index a9b2cbd0f..6a4da5cc5 100644
--- a/examples/rust-wasm-cross/devenv.nix
+++ b/examples/rust-wasm-cross/devenv.nix
@@ -11,7 +11,7 @@
     components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" "rust-std" ];
   };
 
-  pre-commit.hooks = {
+  git-hooks.hooks = {
     clippy = {
       enable = true;
       settings.offline = false;
@@ -19,6 +19,7 @@
     };
     rustfmt.enable = true;
   };
+  git-hooks.settings.rust.cargoManifestPath = "./Cargo.toml";
 
   packages = [
     pkgs.wasm-pack
diff --git a/examples/rust/devenv.nix b/examples/rust/devenv.nix
index c3b024867..724567bf8 100644
--- a/examples/rust/devenv.nix
+++ b/examples/rust/devenv.nix
@@ -9,10 +9,10 @@
     components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
   };
 
-  #pre-commit.hooks = {
-  #  rustfmt.enable = true;
-  #  clippy.enable = true;
-  #};
+  # git-hooks.hooks = {
+  #   rustfmt.enable = true;
+  #   clippy.enable = true;
+  # };
 
   packages = lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
     frameworks.Security
diff --git a/src/modules/languages/rust.nix b/src/modules/languages/rust.nix
index 48ba73bc2..3aaff26f9 100644
--- a/src/modules/languages/rust.nix
+++ b/src/modules/languages/rust.nix
@@ -142,9 +142,9 @@ in
             CFLAGS = lib.optionalString pkgs.stdenv.isDarwin "-iframework ${config.devenv.profile}/Library/Frameworks";
           };
 
-        pre-commit.tools.cargo = mkOverrideTools cfg.toolchain.cargo or null;
-        pre-commit.tools.rustfmt = mkOverrideTools cfg.toolchain.rustfmt or null;
-        pre-commit.tools.clippy = mkOverrideTools cfg.toolchain.clippy or null;
+        git-hooks.tools.cargo = mkOverrideTools cfg.toolchain.cargo or null;
+        git-hooks.tools.rustfmt = mkOverrideTools cfg.toolchain.rustfmt or null;
+        git-hooks.tools.clippy = mkOverrideTools cfg.toolchain.clippy or null;
       }
     )