130 lines
2.6 KiB
Nix
130 lines
2.6 KiB
Nix
{
|
|
sources ? import ./npins,
|
|
pkgs ? import sources.nixpkgs { },
|
|
}:
|
|
|
|
let
|
|
###
|
|
# Pkgs configuration
|
|
|
|
inherit (pkgs.lib)
|
|
genAttrs
|
|
mapAttrs
|
|
mapAttrs'
|
|
nameValuePair
|
|
removeSuffix
|
|
;
|
|
|
|
nix-pkgs = import sources.nix-pkgs { inherit pkgs; };
|
|
kat-pkgs = import sources.kat-pkgs { inherit pkgs; };
|
|
|
|
python3 = pkgs.python3.override {
|
|
packageOverrides = final: prev: {
|
|
inherit (nix-pkgs)
|
|
authens
|
|
django-bootstrap-form
|
|
django-cas-ng
|
|
loadcredential
|
|
;
|
|
|
|
inherit (kat-pkgs.python3Packages)
|
|
django-djconfig
|
|
django-hCaptcha
|
|
wagtail-modeltranslation
|
|
wagtailmenus
|
|
;
|
|
};
|
|
};
|
|
|
|
###
|
|
# CI configuration
|
|
|
|
nix-actions = import sources.nix-actions { inherit pkgs; };
|
|
|
|
workflows = nix-actions.install {
|
|
src = ./.;
|
|
|
|
buildCheck = false;
|
|
|
|
workflows = mapAttrs' (
|
|
name: _:
|
|
nameValuePair (removeSuffix ".nix" name) (
|
|
import ./workflows/${name} {
|
|
inherit nix-actions;
|
|
inherit (pkgs) lib;
|
|
}
|
|
)
|
|
) (builtins.readDir ./workflows);
|
|
};
|
|
|
|
git-hooks = (import sources.git-hooks).run {
|
|
src = ./.;
|
|
|
|
hooks = genAttrs [ "black" "isort" "commitizen" ] (_: {
|
|
enable = true;
|
|
});
|
|
};
|
|
in
|
|
|
|
{
|
|
devShell = pkgs.mkShell {
|
|
shellHook = ''
|
|
${git-hooks.shellHook}
|
|
${workflows.shellHook}
|
|
if [ ! -d .static ]; then
|
|
mkdir .static
|
|
fi
|
|
'';
|
|
|
|
env = {
|
|
CREDENTIALS_DIRECTORY = builtins.toString ./.credentials;
|
|
DJANGO_SETTINGS_MODULE = "gestioasso.settings.local";
|
|
|
|
GESTIOCOF_DEBUG = true;
|
|
GESTIOCOF_STATIC_ROOT = builtins.toString ./.static;
|
|
|
|
GESTIOBDS_DEBUG = true;
|
|
GESTIOBDS_STATIC_ROOT = builtins.toString ./.static;
|
|
};
|
|
|
|
packages = [
|
|
(python3.withPackages (
|
|
ps: with ps; [
|
|
django
|
|
pillow
|
|
authens
|
|
channels
|
|
configparser
|
|
django-autocomplete-light
|
|
django-bootstrap-form
|
|
django-cas-ng
|
|
django-cors-headers
|
|
django-djconfig
|
|
django-hCaptcha
|
|
django-js-reverse
|
|
django-widget-tweaks
|
|
icalendar
|
|
loadcredential
|
|
python-dateutil
|
|
statistics
|
|
wagtail-modeltranslation
|
|
wagtail
|
|
wagtailmenus
|
|
|
|
django-debug-toolbar
|
|
ipython
|
|
black
|
|
flake8
|
|
isort
|
|
]
|
|
))
|
|
pkgs.npins
|
|
] ++ git-hooks.enabledPackages;
|
|
|
|
passthru = mapAttrs (name: value: pkgs.mkShell (value // { inherit name; })) {
|
|
pre-commit.shellHook = git-hooks.shellHook;
|
|
};
|
|
};
|
|
|
|
preferLocalBuild = true;
|
|
}
|