2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchNpmDeps,
|
|
|
|
buildPythonPackage,
|
|
|
|
nix-update-script,
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
gettext,
|
|
|
|
nodejs,
|
|
|
|
npmHooks,
|
|
|
|
setuptools-scm,
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependencies
|
|
|
|
django,
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
pytest-django,
|
|
|
|
pytestCheckHook,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "django-hijack";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "3.4.5";
|
2023-05-24 13:37:59 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "django-hijack";
|
|
|
|
repo = "django-hijack";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-FXh5OFMTjsKgjEeIS+CiOwyGOs4AisJA+g49rCILDsQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace 'cmd = ["npm", "ci"]' 'cmd = ["true"]' \
|
|
|
|
--replace 'f"{self.build_lib}/{name}.mo"' 'f"{name}.mo"'
|
|
|
|
|
|
|
|
sed -i "/addopts/d" setup.cfg
|
|
|
|
'';
|
|
|
|
|
|
|
|
npmDeps = fetchNpmDeps {
|
|
|
|
inherit src;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-cZEr/7FW4vCR8gpraT+/rPwYK9Xn22b5WH7lnuK5L4U=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
gettext
|
|
|
|
nodejs
|
|
|
|
npmHooks.npmConfigHook
|
|
|
|
setuptools-scm
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ django ];
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-01-11 07:51:40 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pytest-django
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
env.DJANGO_SETTINGS_MODULE = "hijack.tests.test_app.settings";
|
2023-01-11 07:51:40 +00:00
|
|
|
|
|
|
|
pytestFlagsArray = [
|
2024-06-05 15:53:02 +00:00
|
|
|
"--pyargs"
|
|
|
|
"hijack"
|
|
|
|
"-W"
|
|
|
|
"ignore::DeprecationWarning"
|
2023-01-11 07:51:40 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
# needed for npmDeps update
|
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Allows superusers to hijack (=login as) and work on behalf of another user";
|
|
|
|
homepage = "https://github.com/arteria/django-hijack";
|
2023-01-11 07:51:40 +00:00
|
|
|
changelog = "https://github.com/django-hijack/django-hijack/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ris ];
|
|
|
|
};
|
|
|
|
}
|