gestiojeux/default.nix
sinavir c01ed7cb47 style(pre-commit): Add hook
Python:
- black
- isort (black profile)
- ruff

Nix:
- statix
- nixfmt-rfc-style
- deadnix
2024-07-04 20:47:46 +02:00

86 lines
1.6 KiB
Nix

{
sources ? import ./npins,
pkgs ? import sources.nixpkgs { },
}:
let
nix-pkgs = import sources.nix-pkgs { inherit pkgs; };
check = (import sources.git-hooks).run {
src = ./.;
hooks = {
# Python hooks
ruff.enable = true;
black.enable = true;
isort.enable = true;
# Nix Hooks
statix.enable = true;
deadnix.enable = true;
rfc101 = {
enable = true;
name = "RFC-101 formatting";
entry = "${pkgs.lib.getExe pkgs.nixfmt-rfc-style}";
files = "\\.nix$";
};
# Misc Hooks
commitizen.enable = true;
};
};
python3 = pkgs.python3.override {
packageOverrides = final: _: {
inherit (nix-pkgs)
django-autoslug
loadcredential
markdown-icons
python-cas
;
authens = final.callPackage ./nix/authens { };
};
};
in
{
devShell = pkgs.mkShell {
name = "gestiojeux.dev";
packages = check.enabledPackages ++ [
(python3.withPackages (ps: [
ps.django
ps.django-types
ps.django-autoslug
ps.loadcredential
ps.django-cleanup
ps.django-haystack
ps.django-markdownx
ps.django-tables2
ps.pillow
ps.whoosh
ps.markdown-icons
ps.authens
ps.qrcode
ps.pillow
# Django haystack is drunk
ps.setuptools
]))
];
env = {
DJANGO_SETTINGS_MODULE = "gestiojeux.settings";
CREDENTIALS_DIRECTORY = builtins.toString ./.credentials;
GESTIOJEUX_DEBUG = builtins.toJSON true;
};
shellHook = ''
${check.shellHook}
'';
};
}