about summary refs log tree commit diff stats
path: root/default.nix
blob: fd92a9065c7415ec42f66713f0641a7e52646bae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
      };
    };
  };
}