dgsi/default.nix

86 lines
1.7 KiB
Nix

{
sources ? import ./npins,
pkgs ? import sources.nixpkgs { },
}:
let
check = (import sources.git-hooks).run {
src = ./.;
hooks = {
# Python hooks
black = {
enable = true;
stages = [ "pre-push" ];
};
isort = {
enable = true;
stages = [ "pre-push" ];
};
# Nix Hooks
statix = {
enable = true;
stages = [ "pre-push" ];
};
deadnix = {
enable = true;
stages = [ "pre-push" ];
};
# Misc Hooks
commitizen.enable = true;
};
};
python = pkgs.python312.override {
packageOverrides =
self: _:
pkgs.lib.genAttrs (builtins.attrNames (builtins.readDir ./pkgs)) (
p: self.callPackage ./pkgs/${p} { }
);
};
in
{
devShell = pkgs.mkShell {
name = "dgsi.dev";
packages = [
pkgs.jq
pkgs.dart-sass
# Python dependencies
(python.withPackages (ps: [
ps.django
ps.django-allauth
ps.django-allauth-cas
ps.django-browser-reload
ps.django-bulma-forms
ps.django-compressor
ps.django-debug-toolbar
ps.django-sass-processor
ps.django-sass-processor-dart-sass
ps.django-stubs
ps.django-unfold
ps.ipython
ps.loadcredential
ps.pykanidm
ps.python-cas
]))
] ++ check.enabledPackages;
env = {
CREDENTIALS_DIRECTORY = builtins.toString ./.credentials;
DGSI_DEBUG = "true";
DGSI_STATIC_ROOT = builtins.toString ./.static;
DGSI_MEDIA_ROOT = builtins.toString ./.media;
DGSI_KANIDM_CLIENT = "dgsi_test";
};
shellHook = ''
${check.shellHook}
'';
};
}