annuaire-eleves/shell.nix

41 lines
971 B
Nix
Raw Normal View History

{ pkgs ? import <nixpkgs> { }, ... }:
let
2023-01-31 13:42:12 +01:00
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
];
2023-01-31 13:42:12 +01:00
shellHook = ''
${pre-commit-check.shellHook}
export DJANGO_SETTINGS_MODULE="annuaire.settings.dev"
2023-01-31 13:42:12 +01:00
'';
}