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

restic-rest-server
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

@ -1,10 +1,10 @@
{ pkgs ? import <nixpkgs> { } }:
{ pkgs ? import <nixpkgs> {} }:
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}
'';
}