1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 python,
6 pythonOlder,
7 django,
8 hatchling,
9 pyhamcrest,
10}:
11let
12 version = "0.6.1";
13in
14buildPythonPackage {
15 pname = "django-currentuser";
16 inherit version;
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "zsoldosp";
21 repo = "django-currentuser";
22 rev = "v${version}";
23 hash = "sha256-sxt4ZMkaFANINd1faIA5pqP8UoDMXElM3unsxcJU/ag=";
24 };
25
26 disabled = pythonOlder "3.8";
27
28 nativeBuildInputs = [ hatchling ];
29
30 propagatedBuildInputs = [ django ];
31
32 nativeCheckInputs = [ pyhamcrest ];
33
34 preCheck = ''
35 DJANGO_SETTINGS_MODULE="settings"
36 PYTHONPATH="tests:$PYTHONPATH"
37 '';
38
39 checkPhase = ''
40 runHook preCheck
41 ${python.interpreter} manage.py test testapp
42 runHook postCheck
43 '';
44
45 meta = with lib; {
46 description = "Conveniently store reference to request user on thread/db level";
47 homepage = "https://github.com/zsoldosp/django-currentuser";
48 changelog = "https://github.com/zsoldosp/django-currentuser/#release-notes";
49 license = licenses.bsd3;
50 maintainers = with maintainers; [ augustebaum ];
51 };
52}