experiENS/default.nix

95 lines
1.8 KiB
Nix
Raw Normal View History

2024-10-23 20:01:03 +02:00
{
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
black = {
enable = true;
stages = [ "pre-push" ];
};
isort = {
enable = true;
stages = [ "pre-push" ];
};
ruff = {
enable = true;
stages = [ "pre-push" ];
};
# Misc Hooks
commitizen.enable = true;
};
};
python3 = pkgs.python3.override {
packageOverrides = _: _: {
inherit (nix-pkgs)
authens
django-braces
django-elasticsearch-dsl
django-simple-email-confirmation
django-taggit-autosuggest
django-tinymce
loadcredential
spatialite
;
};
};
in
{
devShell = pkgs.mkShell {
name = "annuaire.dev";
packages = [
(python3.withPackages (ps: [
ps.authens
ps.django
ps.django-braces
ps.django-elasticsearch-dsl
ps.django-simple-email-confirmation
ps.django-taggit
ps.django-taggit-autosuggest
ps.django-tastypie
ps.django-tinymce
ps.loadcredential
# Dev packages
ps.django-debug-toolbar
ps.django-stubs
ps.spatialite
]))
];
env = {
DJANGO_SETTINGS_MODULE = "app.settings";
CREDENTIALS_DIRECTORY = builtins.toString ./.credentials;
EXPERIENS_DEBUG = builtins.toJSON true;
EXPERIENS_STATIC_ROOT = builtins.toString ./.static;
EXPERIENS_GDAL_LIBRARY_PATH = "${pkgs.gdal}/lib/libgdal.so";
EXPERIENS_GEOS_LIBRARY_PATH = "${pkgs.geos}/lib/libgeos_c.so";
};
shellHook = ''
${check.shellHook}
if [ ! -d .static ]; then
mkdir .static
fi
'';
};
}