Use nixpkgs-fmt hook from pre-commit-hooks.nix

This commit is contained in:
Simon Bruder 2020-10-02 17:15:46 +02:00
parent 1e8a7ee19f
commit 99c4de6d66
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
4 changed files with 16 additions and 6 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
/result
/*.qcow2
/.pre-commit-config.yaml
/result

11
default.nix Normal file
View file

@ -0,0 +1,11 @@
let
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
in
{
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
};
};
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
nixpkgs-fmt --check .

View file

@ -4,7 +4,7 @@ pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixpkgs-fmt
];
buildPhase = ''
ln -f -s ../../pre-commit-hook .git/hooks/pre-commit
shellHook = ''
${(import ./default.nix).pre-commit-check.shellHook}
'';
}