flake.nix: add nixfmt pre-commit hook

This commit is contained in:
Ilya K 2024-08-09 18:46:25 +03:00
parent d234b670d0
commit 306cc77e05
3 changed files with 97 additions and 0 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@ config.tf.json
.terraform.lock.hcl
secrets/*
!secrets/*.age
.pre-commit-config.yaml

View file

@ -278,6 +278,22 @@
"type": "github"
}
},
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@ -385,6 +401,27 @@
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"grapevine": {
"inputs": {
"attic": "attic",
@ -631,6 +668,22 @@
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1723151389,
@ -678,6 +731,29 @@
"type": "github"
}
},
"pre-commit-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_5",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1723202784,
"narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "c7012d0c18567c889b948781bc74a501e92275d1",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"agenix": "agenix",
@ -691,6 +767,7 @@
],
"nix-gerrit": "nix-gerrit",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks_2",
"terranix": "terranix"
}
},

View file

@ -29,6 +29,9 @@
repo = "grapevine-fork";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
@ -37,6 +40,7 @@
nixpkgs,
terranix,
colmena,
pre-commit-hooks,
...
}@inputs:
let
@ -113,6 +117,21 @@
(pkgs.callPackage ./lib/colmena-wrapper.nix { })
];
inherit (inputs.self.checks.${system}.pre-commit) shellHook;
};
}
);
checks = forEachSystem' (
{ system, pkgs, ... }:
{
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks.nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
};
}
);