about summary refs log tree commit diff stats
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix43
1 files changed, 33 insertions, 10 deletions
diff --git a/default.nix b/default.nix
index 2cccff2..fd92a90 100644
--- a/default.nix
+++ b/default.nix
@@ -1,10 +1,33 @@
-(import
-  (
-    let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
-    fetchTarball {
-      url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
-      sha256 = lock.nodes.flake-compat.locked.narHash;
-    }
-  )
-  { src = ./.; }
-).defaultNix
+let
+  sources = import ./npins;
+
+  pkgs = import sources.nixpkgs {
+    overlays = [
+      (import "${sources.gomod2nix}/overlay.nix")
+    ];
+  };
+  pre-commit-hooks = import sources.pre-commit-hooks;
+in
+{
+  pre-commit-check = pre-commit-hooks.run {
+    src = ./.;
+    hooks = {
+      go-mod-tidy = {
+        enable = true;
+        name = "go-mod-tidy";
+        description = "Run `go mod tidy`";
+        types_or = [ "go" "go-mod" ];
+        entry = "${pkgs.go}/bin/go mod tidy";
+        pass_filenames = false;
+      };
+      gomod2nix = {
+        enable = true;
+        name = "gomod2nix";
+        description = "Import go.mod updates to nix";
+        types_or = [ "go-sum" ];
+        entry = "${pkgs.gomod2nix}/bin/gomod2nix --outdir nix";
+        pass_filenames = false;
+      };
+    };
+  };
+}