about summary refs log tree commit diff
path: root/pkgs/development/python-modules/django-currentuser/default.nix
blob: 1b1c5a3f33deb1c68a8f2bf7de612b7e741fc2f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ lib
, buildPythonPackage
, fetchFromGitHub
, python3
, pythonOlder
, django
, hatchling
, pyhamcrest
}:
let
  version = "0.6.1";
in
buildPythonPackage {
  pname = "django-currentuser";
  inherit version;
  pyproject = true;

  src = fetchFromGitHub {
    owner = "zsoldosp";
    repo = "django-currentuser";
    rev = "v${version}";
    hash = "sha256-sxt4ZMkaFANINd1faIA5pqP8UoDMXElM3unsxcJU/ag=";
  };

  disabled = pythonOlder "3.8";

  nativeBuildInputs = [ hatchling ];

  propagatedBuildInputs = [ django ];

  nativeCheckInputs = [ pyhamcrest ];

  preCheck = ''
    DJANGO_SETTINGS_MODULE="settings"
    PYTHONPATH="tests:$PYTHONPATH"
  '';

  checkPhase = ''
    runHook preCheck
    ${python3.interpreter} manage.py test testapp
    runHook postCheck
  '';

  meta = with lib; {
    description = "Conveniently store reference to request user on thread/db level";
    homepage = "https://github.com/zsoldosp/django-currentuser";
    changelog = "https://github.com/zsoldosp/django-currentuser/#release-notes";
    license = licenses.bsd3;
    maintainers = with maintainers; [ augustebaum ];
  };
}