1
0
Fork 0

Install pre-commit-hook

This commit is contained in:
Malte Brandy 2021-05-18 16:28:31 +02:00
parent 5a313a3420
commit e80d63f7c2
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
5 changed files with 33 additions and 1 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/configuration.nix
/.pre-commit-config.yaml

View file

@ -5,5 +5,5 @@ let
nvd = import pkgs.sources.nvd { inherit pkgs; };
in
{
home.activation.report-changes = dag.entryAnywhere "${nvd}/bin/nvd $oldGenPath $newGenPath";
home.activation.report-changes = dag.entryAnywhere "${nvd}/bin/nvd diff $oldGenPath $newGenPath";
}

View file

@ -117,6 +117,18 @@
"url": "https://github.com/obsidiansystems/obelisk/archive/7ad33cbe3e84b209e83c505ce25486445bbd602e.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pre-commit-hooks.nix": {
"branch": "master",
"description": "Seamless integration of https://pre-commit.com git hooks with Nix.",
"homepage": "",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "40a51af82c1181b9dea3526c4124eee077e30213",
"sha256": "0yi1vdi0bdfmwnzrmal103vb5sk9994h6894616ivrn0r3514kai",
"type": "tarball",
"url": "https://github.com/cachix/pre-commit-hooks.nix/archive/40a51af82c1181b9dea3526c4124eee077e30213.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"taskwarrior-git-backend": {
"branch": "master",
"description": "An experimental task-sync alternative via git written in Haskell",

5
shell.nix Normal file
View file

@ -0,0 +1,5 @@
(import (import ./nix/sources.nix).nixos-unstable { }).mkShell {
shellHook = ''
${(import ./test.nix).pre-commit-check.shellHook}
'';
}

14
test.nix Normal file
View file

@ -0,0 +1,14 @@
let
nix-pre-commit-hooks = import (import ./nix/sources.nix)."pre-commit-hooks.nix";
in
{
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {
hlint.enable = true;
nixpkgs-fmt.enable = true;
fourmolu.enable = true;
shellcheck.enable = true;
};
};
}