nix-dot-dev / getting-started-devenv-template

Based on nix.dev tutorials, repository template to get you started with Nix.
https://nix.dev
474 stars 27 forks source link

Update niv fails with: Type tag 'ash' is not recognized. Try upgrading identify and pre-commit? #21

Closed anka-213 closed 3 years ago

anka-213 commented 3 years ago

See the log here: https://github.com/anka-213/cclaw-nix-stuff/runs/1240368729?check_suite_focus=true

I assume it is related to this pull request: https://github.com/cachix/pre-commit-hooks.nix/pull/63

Is there a way to force it to use an older version of pre-commit-hooks.nix, while still updating the other packages?

domenkozar commented 3 years ago

Good catch!

You should be able to fix that by applying:

diff --git a/nix/default.nix b/nix/default.nix
index 091e441..630207d 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -1,13 +1,14 @@
 { sources ? import ./sources.nix
 }:
-
 let
   # default nixpkgs
-  pkgs = import sources.nixpkgs {};
+  pkgs = import sources.nixpkgs { };

   # gitignore.nix 
   gitignoreSource = (import sources."gitignore.nix" { inherit (pkgs) lib; }).gitignoreSource;

+  pre-commit-hooks = (import sources."pre-commit-hooks.nix");
+
   src = gitignoreSource ./..;
 in
 {
@@ -15,12 +16,13 @@ in

   # provided by shell.nix
   devTools = {
-    inherit (pkgs) niv pre-commit;
+    inherit (pkgs) niv;
+    inherit (pre-commit-hooks) pre-commit;
   };

   # to be built by github actions
   ci = {
-    pre-commit-check = (import sources."pre-commit-hooks.nix").run {
+    pre-commit-check = pre-commit-hooks.run {
       inherit src;
       hooks = {
         shellcheck.enable = true;
anka-213 commented 3 years ago

Thanks!