replace pre-commit with shell script

This saves one flake input and some python dependencies
This commit is contained in:
Jörg Thalheim
2023-08-03 14:25:26 +02:00
parent 7fa6808478
commit 930923512c
5 changed files with 56 additions and 142 deletions

View File

@@ -7,7 +7,6 @@
}: {
devShells.default = pkgs.mkShell {
inputsFrom = [
config.pre-commit.devShell
config.treefmt.build.devShell
];
packages = [
@@ -15,6 +14,9 @@
self'.packages.tea-create-pr
self'.packages.merge-after-ci
];
shellHook = ''
ln -sf ../../scripts/pre-commit .git/hooks/pre-commit
'';
};
};
}

View File

@@ -3,10 +3,9 @@
, ...
}: {
imports = [
inputs.pre-commit-hooks-nix.flakeModule
inputs.treefmt-nix.flakeModule
];
perSystem = { pkgs, config, ... }: {
perSystem = { pkgs, ... }: {
treefmt.projectRootFile = "flake.nix";
treefmt.flakeCheck = true;
treefmt.flakeFormatter = true;
@@ -37,18 +36,5 @@
];
includes = [ "*.py" ];
};
# we already run treefmt in ci
pre-commit.check.enable = false;
# activated in devShells via inputsFrom = [config.pre-commit.devShell];
pre-commit.settings.hooks.format-all = {
name = "format-all";
enable = true;
pass_filenames = true;
entry = toString (pkgs.writeScript "treefmt" ''
#!${pkgs.bash}/bin/bash
${config.treefmt.build.wrapper}/bin/treefmt --clear-cache --fail-on-change "$@"
'');
};
};
}