1{ 2 lib, 3 fetchFromGitHub, 4 fetchNpmDeps, 5 buildPythonPackage, 6 nix-update-script, 7 8 # build-system 9 gettext, 10 nodejs, 11 npmHooks, 12 setuptools-scm, 13 14 # dependencies 15 django, 16 17 # tests 18 pytest-django, 19 pytestCheckHook, 20}: 21 22buildPythonPackage rec { 23 pname = "django-hijack"; 24 version = "3.4.5"; 25 format = "setuptools"; 26 27 src = fetchFromGitHub { 28 owner = "django-hijack"; 29 repo = "django-hijack"; 30 rev = "refs/tags/${version}"; 31 hash = "sha256-FXh5OFMTjsKgjEeIS+CiOwyGOs4AisJA+g49rCILDsQ="; 32 }; 33 34 postPatch = '' 35 substituteInPlace setup.py \ 36 --replace 'cmd = ["npm", "ci"]' 'cmd = ["true"]' \ 37 --replace 'f"{self.build_lib}/{name}.mo"' 'f"{name}.mo"' 38 39 sed -i "/addopts/d" setup.cfg 40 ''; 41 42 npmDeps = fetchNpmDeps { 43 inherit src; 44 hash = "sha256-cZEr/7FW4vCR8gpraT+/rPwYK9Xn22b5WH7lnuK5L4U="; 45 }; 46 47 nativeBuildInputs = [ 48 gettext 49 nodejs 50 npmHooks.npmConfigHook 51 setuptools-scm 52 ]; 53 54 propagatedBuildInputs = [ django ]; 55 56 nativeCheckInputs = [ 57 pytestCheckHook 58 pytest-django 59 ]; 60 61 env.DJANGO_SETTINGS_MODULE = "hijack.tests.test_app.settings"; 62 63 pytestFlagsArray = [ 64 "--pyargs" 65 "hijack" 66 "-W" 67 "ignore::DeprecationWarning" 68 ]; 69 70 # needed for npmDeps update 71 passthru.updateScript = nix-update-script { }; 72 73 meta = with lib; { 74 description = "Allows superusers to hijack (=login as) and work on behalf of another user"; 75 homepage = "https://github.com/arteria/django-hijack"; 76 changelog = "https://github.com/django-hijack/django-hijack/releases/tag/${version}"; 77 license = licenses.mit; 78 maintainers = with maintainers; [ ris ]; 79 }; 80}