diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index e555a8f921da..df940e90ff94 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -312,6 +312,14 @@ - The method to safely handle secrets in the `networking.wireless` module has been changed to benefit from a [new feature](https://w1.fi/cgit/hostap/commit/?id=e680a51e94a33591f61edb210926bcb71217a21a) of wpa_supplicant. The syntax to refer to secrets has changed slightly and the option `networking.wireless.environmentFile` has been replaced by `networking.wireless.secretsFile`; see the description of the latter for how to upgrade. +- NetBox was updated to `>= 4.1.0`. + Have a look at the breaking changes + of the [4.0 release](https://github.com/netbox-community/netbox/releases/tag/v4.0.0) + and the [4.1 release](https://github.com/netbox-community/netbox/releases/tag/v4.1.0), + make the required changes to your database, if needed, + then upgrade by setting `services.netbox.package = pkgs.netbox_4_1;` + in your configuration. + - `services.cgit` now runs as the cgit user by default instead of root. This change requires granting access to the repositories to this user or setting the appropriate one through `services.cgit.some-instance.user`. diff --git a/nixos/modules/services/web-apps/netbox.nix b/nixos/modules/services/web-apps/netbox.nix index 7bcbde2a018e..01319722afa9 100644 --- a/nixos/modules/services/web-apps/netbox.nix +++ b/nixos/modules/services/web-apps/netbox.nix @@ -75,21 +75,17 @@ in { package = lib.mkOption { type = lib.types.package; default = - if lib.versionAtLeast config.system.stateVersion "24.05" + if lib.versionAtLeast config.system.stateVersion "24.11" + then pkgs.netbox_4_1 + else if lib.versionAtLeast config.system.stateVersion "24.05" then pkgs.netbox_3_7 - else if lib.versionAtLeast config.system.stateVersion "23.11" - then pkgs.netbox_3_6 - else if lib.versionAtLeast config.system.stateVersion "23.05" - then pkgs.netbox_3_5 - else pkgs.netbox_3_3; + else pkgs.netbox_3_6; defaultText = lib.literalExpression '' - if lib.versionAtLeast config.system.stateVersion "24.05" + if lib.versionAtLeast config.system.stateVersion "24.11" + then pkgs.netbox_4_1 + else if lib.versionAtLeast config.system.stateVersion "24.05" then pkgs.netbox_3_7 - else if lib.versionAtLeast config.system.stateVersion "23.11" - then pkgs.netbox_3_6 - else if lib.versionAtLeast config.system.stateVersion "23.05" - then pkgs.netbox_3_5 - else pkgs.netbox_3_3; + else pkgs.netbox_3_6; ''; description = '' NetBox package to use. @@ -328,6 +324,7 @@ in { --pythonpath ${pkg}/opt/netbox/netbox ''; PrivateTmp = true; + TimeoutStartSec = lib.mkDefault "5min"; }; }; diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5e60805718f6..dd6519ff9361 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -658,6 +658,8 @@ in { networking.networkmanager = handleTest ./networking/networkmanager.nix {}; netbox_3_6 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_3_6; }; netbox_3_7 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_3_7; }; + netbox_4_0 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_4_0; }; + netbox_4_1 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_4_1; }; netbox-upgrade = handleTest ./web-apps/netbox-upgrade.nix {}; # TODO: put in networking.nix after the test becomes more complete networkingProxy = handleTest ./networking-proxy.nix {}; diff --git a/nixos/tests/web-apps/netbox-upgrade.nix b/nixos/tests/web-apps/netbox-upgrade.nix index 4c554e7ae613..b43313bc8a77 100644 --- a/nixos/tests/web-apps/netbox-upgrade.nix +++ b/nixos/tests/web-apps/netbox-upgrade.nix @@ -1,6 +1,6 @@ import ../make-test-python.nix ({ lib, pkgs, ... }: let - oldNetbox = pkgs.netbox_3_6; - newNetbox = pkgs.netbox_3_7; + oldNetbox = pkgs.netbox_3_7; + newNetbox = pkgs.netbox_4_1; in { name = "netbox-upgrade"; @@ -58,8 +58,10 @@ in { return header.split()[1] def check_api_version(version): + # Returns 403 with NetBox >= 4.0, + # but we still get the API version in the headers headers = machine.succeed( - "curl -sSfL http://localhost/api/ --head -H 'Content-Type: application/json'" + "curl -sSL http://localhost/api/ --head -H 'Content-Type: application/json'" ) assert api_version(headers) == version diff --git a/nixos/tests/web-apps/netbox.nix b/nixos/tests/web-apps/netbox.nix index 233f16a8fe0d..2fdd70cfb1bf 100644 --- a/nixos/tests/web-apps/netbox.nix +++ b/nixos/tests/web-apps/netbox.nix @@ -132,7 +132,7 @@ in import ../make-test-python.nix ({ lib, pkgs, netbox, ... }: { testScript = let changePassword = pkgs.writeText "change-password.py" '' - from django.contrib.auth.models import User + from users.models import User u = User.objects.get(username='netbox') u.set_password('netbox') u.save() @@ -171,11 +171,6 @@ in import ../make-test-python.nix ({ lib, pkgs, netbox, ... }: { machine.succeed("curl -sSfL http://localhost/static/netbox.js") machine.succeed("curl -sSfL http://localhost/static/docs/") - with subtest("Can interact with API"): - json.loads( - machine.succeed("curl -sSfL -H 'Accept: application/json' 'http://localhost/api/'") - ) - def login(username: str, password: str): encoded_data = json.dumps({"username": username, "password": password}) uri = "/users/tokens/provision/" diff --git a/pkgs/by-name/ne/netbox_4_0/custom-static-root.patch b/pkgs/by-name/ne/netbox_4_0/custom-static-root.patch new file mode 100644 index 000000000000..c9219fa2b871 --- /dev/null +++ b/pkgs/by-name/ne/netbox_4_0/custom-static-root.patch @@ -0,0 +1,13 @@ +diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py +index 2de06dd10..00406af48 100644 +--- a/netbox/netbox/settings.py ++++ b/netbox/netbox/settings.py +@@ -410,7 +412,7 @@ USE_X_FORWARDED_HOST = True + X_FRAME_OPTIONS = 'SAMEORIGIN' + + # Static files (CSS, JavaScript, Images) +-STATIC_ROOT = BASE_DIR + '/static' ++STATIC_ROOT = getattr(configuration, 'STATIC_ROOT', os.path.join(BASE_DIR, 'static')).rstrip('/') + STATIC_URL = f'/{BASE_PATH}static/' + STATICFILES_DIRS = ( + os.path.join(BASE_DIR, 'project-static', 'dist'), diff --git a/pkgs/by-name/ne/netbox_4_0/django-5.1.patch b/pkgs/by-name/ne/netbox_4_0/django-5.1.patch new file mode 100644 index 000000000000..3976e79067a0 --- /dev/null +++ b/pkgs/by-name/ne/netbox_4_0/django-5.1.patch @@ -0,0 +1,81 @@ +diff --git a/netbox/extras/forms/bulk_import.py b/netbox/extras/forms/bulk_import.py +index f2cf0b721..a17b6712d 100644 +--- a/netbox/extras/forms/bulk_import.py ++++ b/netbox/extras/forms/bulk_import.py +@@ -194,7 +194,7 @@ class Meta: + model = EventRule + fields = ( + 'name', 'description', 'enabled', 'conditions', 'object_types', 'type_create', 'type_update', +- 'type_delete', 'type_job_start', 'type_job_end', 'action_type', 'action_object', 'comments', 'tags' ++ 'type_delete', 'type_job_start', 'type_job_end', 'action_type', 'comments', 'tags' + ) + + def clean(self): +diff --git a/netbox/extras/migrations/0002_squashed_0059.py b/netbox/extras/migrations/0002_squashed_0059.py +index 98bed255a..a403a0e19 100644 +--- a/netbox/extras/migrations/0002_squashed_0059.py ++++ b/netbox/extras/migrations/0002_squashed_0059.py +@@ -131,10 +131,6 @@ class Migration(migrations.Migration): + name='webhook', + unique_together={('payload_url', 'type_create', 'type_update', 'type_delete')}, + ), +- migrations.AlterIndexTogether( +- name='taggeditem', +- index_together={('content_type', 'object_id')}, +- ), + migrations.AlterUniqueTogether( + name='exporttemplate', + unique_together={('content_type', 'name')}, +diff --git a/netbox/extras/migrations/0087_squashed_0098.py b/netbox/extras/migrations/0087_squashed_0098.py +index 55f276ecd..bbe7f79f5 100644 +--- a/netbox/extras/migrations/0087_squashed_0098.py ++++ b/netbox/extras/migrations/0087_squashed_0098.py +@@ -98,10 +98,9 @@ class Migration(migrations.Migration): + name='object_types', + field=models.ManyToManyField(blank=True, related_name='+', to='contenttypes.contenttype'), + ), +- migrations.RenameIndex( ++ migrations.AddIndex( + model_name='taggeditem', +- new_name='extras_tagg_content_717743_idx', +- old_fields=('content_type', 'object_id'), ++ index=models.Index(fields=['content_type', 'object_id'], name='extras_tagg_content_717743_idx'), + ), + migrations.CreateModel( + name='Bookmark', +diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py +index f5e3bca30..4f96bac71 100644 +--- a/netbox/ipam/forms/model_forms.py ++++ b/netbox/ipam/forms/model_forms.py +@@ -588,7 +588,7 @@ class VLANGroupForm(NetBoxModelForm): + class Meta: + model = VLANGroup + fields = [ +- 'name', 'slug', 'description', 'min_vid', 'max_vid', 'scope_type', 'scope', 'tags', ++ 'name', 'slug', 'description', 'min_vid', 'max_vid', 'scope_type', 'tags', + ] + + def __init__(self, *args, **kwargs): +diff --git a/netbox/vpn/forms/model_forms.py b/netbox/vpn/forms/model_forms.py +index a17ca9a5e..dee98afd3 100644 +--- a/netbox/vpn/forms/model_forms.py ++++ b/netbox/vpn/forms/model_forms.py +@@ -258,7 +258,7 @@ class TunnelTerminationForm(NetBoxModelForm): + class Meta: + model = TunnelTermination + fields = [ +- 'tunnel', 'role', 'termination', 'outside_ip', 'tags', ++ 'tunnel', 'role', 'outside_ip', 'tags', + ] + + def __init__(self, *args, initial=None, **kwargs): +diff --git a/requirements.txt b/requirements.txt +index 09f23871c..57f167dae 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,4 +1,4 @@ +-Django==5.0.9 ++Django==5.1.2 + django-cors-headers==4.4.0 + django-debug-toolbar==4.4.6 + django-filter==24.2 diff --git a/pkgs/by-name/ne/netbox_4_0/package.nix b/pkgs/by-name/ne/netbox_4_0/package.nix new file mode 100644 index 000000000000..81b05c2679d6 --- /dev/null +++ b/pkgs/by-name/ne/netbox_4_0/package.nix @@ -0,0 +1,132 @@ +{ + lib, + fetchFromGitHub, + python3, + plugins ? _ps: [ ], + nixosTests, +}: +let + py = python3.override { + packageOverrides = _final: prev: { django = prev.django_5; }; + }; + + extraBuildInputs = plugins py.pkgs; +in +py.pkgs.buildPythonApplication rec { + pname = "netbox"; + version = "4.0.11"; + + format = "other"; + + src = fetchFromGitHub { + owner = "netbox-community"; + repo = "netbox"; + rev = "refs/tags/v${version}"; + hash = "sha256-0yEz7v5RL1+cqbGDyuyEsywFonJQfPdVIQdL0qLyc04="; + }; + + patches = [ + ./custom-static-root.patch + # From https://github.com/netbox-community/netbox/pull/17620 + ./django-5.1.patch + ]; + + propagatedBuildInputs = + ( + with py.pkgs; + [ + django + django-cors-headers + django-debug-toolbar + django-filter + django-graphiql-debug-toolbar + django-htmx + django-mptt + django-pglocks + django-prometheus + django-redis + django-rq + django-tables2 + django-taggit + django-timezone-field + djangorestframework + drf-spectacular + drf-spectacular-sidecar + feedparser + jinja2 + markdown + netaddr + nh3 + pillow + psycopg + psycopg.optional-dependencies.c + psycopg.optional-dependencies.pool + pyyaml + requests + social-auth-core + social-auth-app-django + strawberry-graphql + strawberry-django + svgwrite + tablib + + # Optional dependencies, kept here for backward compatibility + + # for the S3 data source backend + boto3 + # for Git data source backend + dulwich + # for error reporting + sentry-sdk + ] + ++ social-auth-core.passthru.optional-dependencies.openidconnect + ) + ++ extraBuildInputs; + + buildInputs = with py.pkgs; [ + mkdocs-material + mkdocs-material-extensions + mkdocstrings + mkdocstrings-python + ]; + + nativeBuildInputs = [ py.pkgs.mkdocs ]; + + postBuild = '' + PYTHONPATH=$PYTHONPATH:netbox/ + python -m mkdocs build + ''; + + installPhase = '' + mkdir -p $out/opt/netbox + cp -r . $out/opt/netbox + chmod +x $out/opt/netbox/netbox/manage.py + makeWrapper $out/opt/netbox/netbox/manage.py $out/bin/netbox \ + --prefix PYTHONPATH : "$PYTHONPATH" + ''; + + passthru = { + python = python3; + # PYTHONPATH of all dependencies used by the package + pythonPath = py.pkgs.makePythonPath propagatedBuildInputs; + inherit (py.pkgs) gunicorn; + tests = { + netbox = nixosTests.netbox_4_0; + }; + }; + + meta = { + homepage = "https://github.com/netbox-community/netbox"; + description = "IP address management (IPAM) and data center infrastructure management (DCIM) tool"; + mainProgram = "netbox"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ + minijackson + n0emis + raitobezarius + ]; + knownVulnerabilities = [ + "Netbox version ${version} is EOL; please upgrade by following the current release notes instructions." + ]; + }; +} diff --git a/pkgs/by-name/ne/netbox_4_1/custom-static-root.patch b/pkgs/by-name/ne/netbox_4_1/custom-static-root.patch new file mode 100644 index 000000000000..c9219fa2b871 --- /dev/null +++ b/pkgs/by-name/ne/netbox_4_1/custom-static-root.patch @@ -0,0 +1,13 @@ +diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py +index 2de06dd10..00406af48 100644 +--- a/netbox/netbox/settings.py ++++ b/netbox/netbox/settings.py +@@ -410,7 +412,7 @@ USE_X_FORWARDED_HOST = True + X_FRAME_OPTIONS = 'SAMEORIGIN' + + # Static files (CSS, JavaScript, Images) +-STATIC_ROOT = BASE_DIR + '/static' ++STATIC_ROOT = getattr(configuration, 'STATIC_ROOT', os.path.join(BASE_DIR, 'static')).rstrip('/') + STATIC_URL = f'/{BASE_PATH}static/' + STATICFILES_DIRS = ( + os.path.join(BASE_DIR, 'project-static', 'dist'), diff --git a/pkgs/by-name/ne/netbox_4_1/package.nix b/pkgs/by-name/ne/netbox_4_1/package.nix new file mode 100644 index 000000000000..be5b53042793 --- /dev/null +++ b/pkgs/by-name/ne/netbox_4_1/package.nix @@ -0,0 +1,133 @@ +{ + lib, + fetchFromGitHub, + fetchpatch, + python3, + plugins ? _ps: [ ], + nixosTests, +}: +let + py = python3.override { + packageOverrides = _final: prev: { django = prev.django_5; }; + }; + + extraBuildInputs = plugins py.pkgs; +in +py.pkgs.buildPythonApplication rec { + pname = "netbox"; + version = "4.1.3"; + + format = "other"; + + src = fetchFromGitHub { + owner = "netbox-community"; + repo = "netbox"; + rev = "refs/tags/v${version}"; + hash = "sha256-SRzkmRkniVDu6vYGa9Kd9exob/LHpGBPd+lRA/pbCFo="; + }; + + patches = [ + ./custom-static-root.patch + (fetchpatch { + url = "https://github.com/netbox-community/netbox/pull/17620.patch"; + hash = "sha256-zN2zke4qlNJUbxI8mSV+zGmEv0Qtd0zSCbCXWyE1L2k="; + }) + ]; + + propagatedBuildInputs = + ( + with py.pkgs; + [ + django + django-cors-headers + django-debug-toolbar + django-filter + django-graphiql-debug-toolbar + django-htmx + django-mptt + django-pglocks + django-prometheus + django-redis + django-rq + django-tables2 + django-taggit + django-timezone-field + djangorestframework + drf-spectacular + drf-spectacular-sidecar + feedparser + jinja2 + markdown + netaddr + nh3 + pillow + psycopg + psycopg.optional-dependencies.c + psycopg.optional-dependencies.pool + pyyaml + requests + social-auth-core + social-auth-app-django + strawberry-graphql + strawberry-django + svgwrite + tablib + + # Optional dependencies, kept here for backward compatibility + + # for the S3 data source backend + boto3 + # for Git data source backend + dulwich + # for error reporting + sentry-sdk + ] + ++ social-auth-core.passthru.optional-dependencies.openidconnect + ) + ++ extraBuildInputs; + + buildInputs = with py.pkgs; [ + mkdocs-material + mkdocs-material-extensions + mkdocstrings + mkdocstrings-python + ]; + + nativeBuildInputs = [ py.pkgs.mkdocs ]; + + postBuild = '' + PYTHONPATH=$PYTHONPATH:netbox/ + python -m mkdocs build + ''; + + installPhase = '' + mkdir -p $out/opt/netbox + cp -r . $out/opt/netbox + chmod +x $out/opt/netbox/netbox/manage.py + makeWrapper $out/opt/netbox/netbox/manage.py $out/bin/netbox \ + --prefix PYTHONPATH : "$PYTHONPATH" + ''; + + passthru = { + python = python3; + # PYTHONPATH of all dependencies used by the package + pythonPath = py.pkgs.makePythonPath propagatedBuildInputs; + inherit (py.pkgs) gunicorn; + tests = { + netbox = nixosTests.netbox_4_1; + inherit (nixosTests) netbox-upgrade; + }; + }; + + meta = { + homepage = "https://github.com/netbox-community/netbox"; + description = "IP address management (IPAM) and data center infrastructure management (DCIM) tool"; + mainProgram = "netbox"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ + minijackson + n0emis + raitobezarius + ]; + }; +} diff --git a/pkgs/development/python-modules/django-choices-field/default.nix b/pkgs/development/python-modules/django-choices-field/default.nix new file mode 100644 index 000000000000..ea115e5c6258 --- /dev/null +++ b/pkgs/development/python-modules/django-choices-field/default.nix @@ -0,0 +1,46 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + django, + typing-extensions, + pytestCheckHook, + pytest-cov-stub, + pytest-django, +}: + +buildPythonPackage rec { + pname = "django-choices-field"; + version = "2.3.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "bellini666"; + repo = "django-choices-field"; + rev = "v${version}"; + hash = "sha256-2oLMUM/aE4aY0eEU+CLIjTNQJAMUt/GK5Fw26QN7t34="; + }; + + build-system = [ poetry-core ]; + + dependencies = [ + django + typing-extensions + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-cov-stub + pytest-django + ]; + + pythonImportsCheck = [ "django_choices_field" ]; + + meta = { + description = "Django field that set/get django's new TextChoices/IntegerChoices enum"; + homepage = "https://github.com/bellini666/django-choices-field"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ minijackson ]; + }; +} diff --git a/pkgs/development/python-modules/django-htmx/default.nix b/pkgs/development/python-modules/django-htmx/default.nix new file mode 100644 index 000000000000..0e60a5ae5aef --- /dev/null +++ b/pkgs/development/python-modules/django-htmx/default.nix @@ -0,0 +1,44 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + asgiref, + django, + pytestCheckHook, + pytest-django, +}: + +buildPythonPackage rec { + pname = "django-htmx"; + version = "1.19.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "adamchainz"; + repo = "django-htmx"; + rev = version; + hash = "sha256-nSutErUkFafKjBswhC+Lrn39MgCbCrzttAx1a+qt1so="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + asgiref + django + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-django + ]; + + pythonImportsCheck = [ "django_htmx" ]; + + meta = { + description = "Extensions for using Django with htmx"; + homepage = "https://github.com/adamchainz/django-htmx"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ minijackson ]; + }; +} diff --git a/pkgs/development/python-modules/django-mptt/default.nix b/pkgs/development/python-modules/django-mptt/default.nix index 419bb9c8eebc..404b6df1bc90 100644 --- a/pkgs/development/python-modules/django-mptt/default.nix +++ b/pkgs/development/python-modules/django-mptt/default.nix @@ -2,35 +2,34 @@ lib, buildPythonPackage, fetchFromGitHub, + hatchling, django, django-js-asset, - python, }: buildPythonPackage rec { pname = "django-mptt"; - version = "0.13.4"; - format = "setuptools"; + version = "0.16"; + pyproject = true; src = fetchFromGitHub { - owner = pname; - repo = pname; + owner = "django-mptt"; + repo = "django-mptt"; rev = version; - sha256 = "12y3chxhqxk2yxin055f0f45nabj0s8hil12hw0lwzlbax6k9ss6"; + hash = "sha256-vWnXKWzaa5AWoNaIc8NA1B2mnzKXRliQmi5VdrRMadE="; }; - propagatedBuildInputs = [ + build-system = [ hatchling ]; + + dependencies = [ django django-js-asset ]; pythonImportsCheck = [ "mptt" ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} tests/manage.py test - runHook postCheck - ''; + # No pytest checks, since they depend on model_mommy, which is deprecated + doCheck = false; meta = with lib; { description = "Utilities for implementing a modified pre-order traversal tree in Django"; diff --git a/pkgs/development/python-modules/django-polymorphic/default.nix b/pkgs/development/python-modules/django-polymorphic/default.nix index b313276bbf6b..86bc344fd070 100644 --- a/pkgs/development/python-modules/django-polymorphic/default.nix +++ b/pkgs/development/python-modules/django-polymorphic/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + fetchpatch, python, django, dj-database-url, @@ -19,10 +20,21 @@ buildPythonPackage rec { hash = "sha256-JJY+FoMPSnWuSsNIas2JedGJpdm6RfPE3E1VIjGuXIc="; }; + patches = [ + # Spelling of assertQuerySetEqual changed in Django >= 4.2 + (fetchpatch { + url = "https://github.com/jazzband/django-polymorphic/commit/63d291f8771847e716a37652f239e3966a3360e1.patch"; + hash = "sha256-rvvD9zfjm8bgH1460BA5K44Oobzv1FRAYq9Rgg291B8="; + }) + ]; + propagatedBuildInputs = [ django ]; nativeCheckInputs = [ dj-database-url ]; + # Tests fail for Django >= 5.1.0 + doCheck = lib.versionOlder django.version "5.1.0"; + checkPhase = '' ${python.interpreter} runtests.py ''; diff --git a/pkgs/development/python-modules/netbox-reorder-rack/default.nix b/pkgs/development/python-modules/netbox-reorder-rack/default.nix index bb079f2eda34..4d127053d5c3 100644 --- a/pkgs/development/python-modules/netbox-reorder-rack/default.nix +++ b/pkgs/development/python-modules/netbox-reorder-rack/default.nix @@ -9,14 +9,14 @@ buildPythonPackage rec { pname = "netbox-reorder-rack"; - version = "1.0.0"; + version = "1.1.2"; pyproject = true; src = fetchFromGitHub { owner = "netbox-community"; repo = "netbox-reorder-rack"; rev = "v${version}"; - hash = "sha256-UbTq3DHxSczDxQIUyAHCVJG3SZdqgyS9ULNvuDKQvEY="; + hash = "sha256-0572pj1OA08Zxl4vhMmFHvQA/K24hG/GhKEbo+hbW5Q="; }; build-system = [ diff --git a/pkgs/development/python-modules/strawberry-django/default.nix b/pkgs/development/python-modules/strawberry-django/default.nix new file mode 100644 index 000000000000..ea6326714e57 --- /dev/null +++ b/pkgs/development/python-modules/strawberry-django/default.nix @@ -0,0 +1,79 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + setuptools, + asgiref, + django, + strawberry-graphql, + django-debug-toolbar, + django-choices-field, + + # check inputs + pytestCheckHook, + django-guardian, + django-mptt, + django-polymorphic, + factory-boy, + pillow, + psycopg2, + pytest-cov-stub, + pytest-django, + pytest-mock, + pytest-snapshot, +}: + +buildPythonPackage rec { + pname = "strawberry-django"; + version = "0.47.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "strawberry-graphql"; + repo = "strawberry-django"; + rev = "v${version}"; + hash = "sha256-N7/EJ1AQ2xUJCEX6/xtyH1o/CuDzlvrUtpoDLq+H1WU="; + }; + + build-system = [ + poetry-core + setuptools + ]; + + dependencies = [ + asgiref + django + strawberry-graphql + ]; + + nativeCheckInputs = [ + pytestCheckHook + + django-guardian + django-mptt + django-polymorphic + factory-boy + pillow + psycopg2 + pytest-cov-stub + pytest-django + pytest-mock + pytest-snapshot + ] ++ optional-dependencies.debug-toolbar ++ optional-dependencies.enum; + + pythonImportsCheck = [ "strawberry_django" ]; + + optional-dependencies = { + debug-toolbar = [ django-debug-toolbar ]; + enum = [ django-choices-field ]; + }; + + meta = { + description = "Strawberry GraphQL Django extension"; + homepage = "https://github.com/strawberry-graphql/strawberry-django"; + changelog = "https://github.com/strawberry-graphql/strawberry-django/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ minijackson ]; + }; +} diff --git a/pkgs/servers/web-apps/netbox/default.nix b/pkgs/servers/web-apps/netbox/default.nix index 1459ee23920c..d494d128e5b0 100644 --- a/pkgs/servers/web-apps/netbox/default.nix +++ b/pkgs/servers/web-apps/netbox/default.nix @@ -1,26 +1,12 @@ -{ lib, nixosTests, callPackage, }: +{ + lib, + nixosTests, + callPackage, +}: let generic = import ./generic.nix; in -lib.fix (self: { - netbox = self.netbox_3_7; - - netbox_3_6 = callPackage generic { - version = "3.6.9"; - hash = "sha256-R/hcBKrylW3GnEy10DkrLVr8YJtsSCvCP9H9LhafO9I="; - extraPatches = [ - # Allow setting the STATIC_ROOT from within the configuration and setting a custom redis URL - ./config.patch - ]; - tests = { - netbox = nixosTests.netbox_3_6; - inherit (nixosTests) netbox-upgrade; - }; - - maintainers = with lib.maintainers; [ minijackson n0emis raitobezarius ]; - eol = true; - }; - +{ netbox_3_7 = callPackage generic { version = "3.7.8"; hash = "sha256-61pJbMWXNFnvWI0z9yWvsutdCAP4VydeceANNw0nKsk="; @@ -28,11 +14,13 @@ lib.fix (self: { # Allow setting the STATIC_ROOT from within the configuration and setting a custom redis URL ./config.patch ]; - tests = { - netbox = nixosTests.netbox_3_7; - inherit (nixosTests) netbox-upgrade; - }; + tests.netbox = nixosTests.netbox_3_7; - maintainers = with lib.maintainers; [ minijackson n0emis raitobezarius ]; + maintainers = with lib.maintainers; [ + minijackson + n0emis + raitobezarius + ]; + eol = true; }; -}) +} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 8a8d21480c33..485e01809226 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -770,6 +770,8 @@ mapAliases { ncdu_2 = ncdu; # Added 2022-07-22 neocities-cli = neocities; # Added 2024-07-31 + netbox_3_3 = throw "netbox 3.3 series has been removed as it was EOL"; # Added 2023-09-02 + netbox_3_5 = throw "netbox 3.5 series has been removed as it was EOL"; # Added 2024-01-22 nextcloud27 = throw '' Nextcloud v27 has been removed from `nixpkgs` as the support for is dropped by upstream in 2024-06. Please upgrade to at least Nextcloud v28 by declaring diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 67153be49f77..bb1ca051f067 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10274,8 +10274,10 @@ with pkgs; netbootxyz-efi = callPackage ../tools/misc/netbootxyz-efi { }; - inherit (callPackage ../servers/web-apps/netbox { }) - netbox netbox_3_6 netbox_3_7; + inherit (callPackage ../servers/web-apps/netbox { }) netbox_3_7; + + # Not in aliases because it wouldn't get picked up by callPackage + netbox = netbox_4_1; netbox2netshot = callPackage ../tools/admin/netbox2netshot { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c09180a5bd4b..2aa4861822c8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3336,6 +3336,8 @@ self: super: with self; { django-celery-results = callPackage ../development/python-modules/django-celery-results { }; + django-choices-field = callPackage ../development/python-modules/django-choices-field { }; + django-ckeditor = callPackage ../development/python-modules/django-ckeditor { }; django-classy-tags = callPackage ../development/python-modules/django-classy-tags { }; @@ -3406,6 +3408,8 @@ self: super: with self; { django-hijack = callPackage ../development/python-modules/django-hijack { }; + django-htmx = callPackage ../development/python-modules/django-htmx { }; + django-i18nfield = callPackage ../development/python-modules/django-i18nfield { }; django-import-export = callPackage ../development/python-modules/django-import-export { }; @@ -15093,6 +15097,8 @@ self: super: with self; { strawberry-graphql = callPackage ../development/python-modules/strawberry-graphql { }; + strawberry-django = callPackage ../development/python-modules/strawberry-django { }; + strct = callPackage ../development/python-modules/strct { }; streamcontroller-plugin-tools = callPackage ../development/python-modules/streamcontroller-plugin-tools { };