1{
2 inputs = {
3 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4 pre-commit-hooks.url = "github:cachix/git-hooks.nix";
5 pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
6 };
7 outputs =
8 {
9 self,
10 nixpkgs,
11 pre-commit-hooks,
12 ...
13 }:
14 let
15 eachSystem = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
16 in
17 {
18 devShells = eachSystem (
19 system:
20 let
21 pkgs = import nixpkgs { inherit system; };
22 in
23 {
24 default = pkgs.mkShell {
25 inherit (self.checks.${system}.pre-commit-check) shellHook;
26 buildInputs =
27 with pkgs;
28 [
29 python3
30 just
31 nixfmt-rfc-style
32 ruff
33 uv
34 ]
35 ++ self.checks.${system}.pre-commit-check.enabledPackages;
36 };
37 }
38 );
39 checks = eachSystem (system: {
40 pre-commit-check = pre-commit-hooks.lib.${system}.run {
41 src = ./.;
42 hooks = {
43 check-added-large-files.enable = true;
44 check-executables-have-shebangs.enable = true;
45 check-shebang-scripts-are-executable.enable = true;
46 check-symlinks.enable = true;
47 end-of-file-fixer.enable = true;
48 nixfmt-rfc-style.enable = true;
49 pyright.enable = true;
50 ruff-format.enable = true;
51 ruff.enable = true;
52 # Uncomment for django projects
53 # ruff-format.excludes = [ "^.*migrations/" ];
54 # pyright.excludes = [ "^.*migrations/" ];
55 };
56 };
57 });
58 };
59}