diff --git a/.gitignore b/.gitignore index ce3dce1e..b6ea11e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /configuration.nix +/.pre-commit-config.yaml diff --git a/home-manager/roles/nvd.nix b/home-manager/roles/nvd.nix index 89d64e6b..3174bee8 100644 --- a/home-manager/roles/nvd.nix +++ b/home-manager/roles/nvd.nix @@ -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"; } diff --git a/nix/sources.json b/nix/sources.json index cb03d172..a45c0b5e 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -117,6 +117,18 @@ "url": "https://github.com/obsidiansystems/obelisk/archive/7ad33cbe3e84b209e83c505ce25486445bbd602e.tar.gz", "url_template": "https://github.com///archive/.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///archive/.tar.gz" + }, "taskwarrior-git-backend": { "branch": "master", "description": "An experimental task-sync alternative via git written in Haskell", diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..c9197a20 --- /dev/null +++ b/shell.nix @@ -0,0 +1,5 @@ +(import (import ./nix/sources.nix).nixos-unstable { }).mkShell { + shellHook = '' + ${(import ./test.nix).pre-commit-check.shellHook} + ''; +} diff --git a/test.nix b/test.nix new file mode 100644 index 00000000..e04c5427 --- /dev/null +++ b/test.nix @@ -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; + }; + }; +}