replace pre-commit with shell script
This saves one flake input and some python dependencies
This commit is contained in:
@@ -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
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 "$@"
|
||||
'');
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user