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