40 lines
971 B
Nix
40 lines
971 B
Nix
{ pkgs ? import <nixpkgs> { }, ... }:
|
|
|
|
let
|
|
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
|
|
pre-commit-check = nix-pre-commit-hooks.run {
|
|
src = ./.;
|
|
hooks = {
|
|
black.enable = true;
|
|
isort.enable = true;
|
|
flake8.enable = true;
|
|
};
|
|
};
|
|
|
|
mkSetup = self: super: pkg: super.${pkg}.overridePythonAttrs (old: { buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ]; });
|
|
|
|
poetryEnv = pkgs.poetry2nix.mkPoetryEnv {
|
|
projectDir = ./.;
|
|
python = pkgs.python39;
|
|
preferWheels = true;
|
|
|
|
overrides = pkgs.poetry2nix.overrides.withDefaults (self: super: {
|
|
python-ldap = mkSetup self super "python-ldap";
|
|
|
|
authens = mkSetup self super "authens";
|
|
});
|
|
};
|
|
in
|
|
|
|
pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.poetry
|
|
poetryEnv
|
|
];
|
|
|
|
shellHook = ''
|
|
${pre-commit-check.shellHook}
|
|
|
|
export DJANGO_SETTINGS_MODULE="annuaire.settings.dev"
|
|
'';
|
|
}
|