Use pre-commit hook from pre-commit-hooks.nix
This commit is contained in:
parent
f8cf89b532
commit
e39b3dac30
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
wordclock_credentials.py
|
||||
/.pre-commit-config.yaml
|
||||
__pycache__
|
||||
wordclock_credentials.py
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: stable
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3
|
11
default.nix
Normal file
11
default.nix
Normal 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 = {
|
||||
black.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -2,13 +2,9 @@
|
|||
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
gitAndTools.pre-commit
|
||||
(python3.withPackages(ps: [ ps.virtualenv ]))
|
||||
nixpkgs-fmt
|
||||
];
|
||||
shellHook = ''
|
||||
# black’s pre-commit hook builds a wheel (zip file) for black and fails
|
||||
# when the timestamp is lower than 1980 (due to zip limitations)
|
||||
export SOURCE_DATE_EPOCH=315532800
|
||||
pre-commit install -f >/dev/null
|
||||
${(import ./default.nix).pre-commit-check.shellHook}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue