diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 3e5d224e5a3f..c0c9169150de 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -302,9 +302,11 @@ - `chatgpt` has been retargeted to OpenAI's new ChatGPT desktop app, while the previous app has been renamed to `chatgpt-classic`. -- NetBox was updated to `>= 4.6.8`. Have a look at the breaking changes - of the [4.6 release](https://github.com/netbox-community/netbox/releases/tag/v4.6.0), - make the required changes to your database, if needed, then upgrade by setting `services.netbox.package = pkgs.netbox_4_6;` in your configuration. +- NetBox was updated to `>= 4.7.0`. Have a look at the breaking changes + of the [4.6 release](https://github.com/netbox-community/netbox/releases/tag/v4.6.0) + and the [4.7 release](https://github.com/netbox-community/netbox/releases/tag/v4.7.0), + make the required changes to your configuration and database, if needed, + before you upgrade to NixOS 26.11. - The COSMIC desktop module now enables by default `system76-power` and `system76-scheduler` following upstream recommended packages. The previous power managment service can be enabled back by setting `services.power-profiles-daemon.enable = true`. diff --git a/nixos/modules/services/web-apps/netbox.nix b/nixos/modules/services/web-apps/netbox.nix index 3bf417d9129c..22ff64c36f5a 100644 --- a/nixos/modules/services/web-apps/netbox.nix +++ b/nixos/modules/services/web-apps/netbox.nix @@ -434,10 +434,10 @@ in package = lib.mkOption { type = types.package; default = - if lib.versionAtLeast config.system.stateVersion "26.11" then pkgs.netbox_4_6 else pkgs.netbox_4_5; + if lib.versionAtLeast config.system.stateVersion "26.11" then pkgs.netbox_4_7 else pkgs.netbox_4_5; defaultText = lib.literalExpression '' if lib.versionAtLeast config.system.stateVersion "26.11" then - pkgs.netbox_4_6 + pkgs.netbox_4_7 else pkgs.netbox_4_5; ''; @@ -563,6 +563,15 @@ in config = lib.mkIf cfg.enable ( lib.mkMerge [ { + assertions = [ + { + assertion = + cfg.postgresql.createLocally + -> lib.versionAtLeast config.services.postgresql.finalPackage.version "15"; + message = "NetBox requires PostgreSQL >= 15. Please read the NixOS manual to upgrade your PostgreSQL version."; + } + ]; + services.netbox.plugins = lib.mkIf enableLDAP (ps: [ ps.django-auth-ldap ]); services.redis.servers.netbox.enable = cfg.redis.createLocally; @@ -733,26 +742,6 @@ in PrivateTmp = true; }; }; - - netbox-housekeeping = defaultUnitConfig // { - description = "NetBox housekeeping job"; - - wantedBy = [ "multi-user.target" ]; - - after = [ - "network-online.target" - "netbox.service" - ]; - wants = [ "network-online.target" ]; - - serviceConfig = defaultServiceConfig // { - Type = "oneshot"; - ExecStart = toString [ - (lib.getExe finalPackage) - "housekeeping" - ]; - }; - }; }; systemd.timers.netbox-housekeeping = { diff --git a/nixos/tests/web-apps/netbox/default.nix b/nixos/tests/web-apps/netbox/default.nix index f69eb85cf72e..c76be640a66e 100644 --- a/nixos/tests/web-apps/netbox/default.nix +++ b/nixos/tests/web-apps/netbox/default.nix @@ -126,6 +126,8 @@ in networking.firewall.allowedTCPPorts = [ 80 ]; }; + interactive.sshBackdoor.enable = true; + testScript = let changePassword = pkgs.writeText "change-password.py" '' diff --git a/pkgs/by-name/ne/netbox/package.nix b/pkgs/by-name/ne/netbox/package.nix index 249f5c8a072d..8239843cd53c 100644 --- a/pkgs/by-name/ne/netbox/package.nix +++ b/pkgs/by-name/ne/netbox/package.nix @@ -2,7 +2,6 @@ lib, fetchFromGitHub, python3, - fetchpatch2, plugins ? _ps: [ ], nixosTests, nix-update-script, @@ -21,24 +20,18 @@ py.pkgs.buildPythonApplication (finalAttrs: { __structuredAttrs = true; pname = "netbox"; - version = "4.6.8"; + version = "4.7.1"; pyproject = false; src = fetchFromGitHub { owner = "netbox-community"; repo = "netbox"; tag = "v${finalAttrs.version}"; - hash = "sha256-fhEcQBYL5R9Tv9CpAf3Ce1oIzsXCjtH5j+dP9sD6kdg="; + hash = "sha256-6IJrDD+1yBv15cbJwZOLkwiAlGZH2zRC+a/CG79C10Y="; }; patches = [ ./custom-static-root.patch - # TODO: remove before upgrading to NetBox v4.7 - (fetchpatch2 { - name = "upgrade-django-tables2-v3.0.patch"; - url = "https://github.com/netbox-community/netbox/commit/d57346d9f0eef8126eafcd5033ea43864faeaf0d.patch"; - hash = "sha256-6/wdd8wDVT4eqDKMNx8tmoPTDvw8OE7atf9nzg3LZzk="; - }) ]; dependencies = @@ -50,10 +43,9 @@ py.pkgs.buildPythonApplication (finalAttrs: { django-cors-headers django-debug-toolbar django-filter - django-graphiql-debug-toolbar django-htmx django-mptt - django-pglocks + django-pgware django-prometheus django-redis django-rq diff --git a/pkgs/development/python-modules/django-pgware/default.nix b/pkgs/development/python-modules/django-pgware/default.nix new file mode 100644 index 000000000000..f03fbcb1c98c --- /dev/null +++ b/pkgs/development/python-modules/django-pgware/default.nix @@ -0,0 +1,70 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + hatchling, + django, + postgresql, + postgresqlTestHook, + pytestCheckHook, + pytest-django, + pytest-asyncio, + psycopg2, + psycopg, + nix-update-script, +}: + +buildPythonPackage (finalAttrs: { + pname = "django-pgware"; + version = "1.0.0"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "Xof"; + repo = "django-pgware"; + tag = "v${finalAttrs.version}"; + hash = "sha256-OvdgqM0W6KPkszNrpeRjmg/powepPyKhfP1OsWaDMSE="; + }; + + build-system = [ hatchling ]; + dependencies = [ django ]; + nativeCheckInputs = [ + postgresql + postgresqlTestHook + pytestCheckHook + pytest-django + pytest-asyncio + psycopg2 + ]; + + optional-dependencies = { + psycopg2 = [ + psycopg2 + ]; + psycopg3 = [ + psycopg + ]; + }; + + pythonImportsCheck = [ "django_pg_utils" ]; + + env.PGDATABASE = "django_pg_utils"; + + preCheck = '' + # Else we get: + # django.core.exceptions.ImproperlyConfigured: Requested setting , but settings are not configured + export DJANGO_SETTINGS_MODULE="tests.django_settings" + export POSTGRES_HOST="$PGHOST" + ''; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Useful PostgreSQL-specific Django utiites"; + homepage = "https://github.com/Xof/django-pgware"; + changelog = "https://github.com/Xof/django-pgware/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = [ lib.licenses.postgresql ]; + maintainers = with lib.maintainers; [ minijackson ]; + }; +}) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 630ad56dad84..12b9281fc51d 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1814,6 +1814,7 @@ mapAliases { netbox_4_3 = throw "netbox 4.3 series has been removed as it was EOL"; # Added 2026-08-24 netbox_4_4 = throw "netbox 4.4 series has been removed as it was EOL"; # Added 2026-08-24 netbox_4_5 = throw "netbox 4.5 series has been removed as it was EOL"; # Added 2026-08-24 + netbox_4_6 = throw "netbox 4.6 series has been removed as it was EOL"; # Added 2026-08-24 netbsdCross = throw "'netbsdCross' has been renamed to/replaced by 'netbsd'"; # Converted to throw 2025-10-27 netsurf.browser = throw "'netsurf.browser' has been renamed to/replaced by 'netsurf-browser'"; # Converted to throw 2025-10-27 netsurf.buildsystem = throw "'netsurf.buildsystem' has been renamed to/replaced by 'netsurf-buildsystem'"; # Converted to throw 2025-10-27 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd695a49d734..d8329ef5cb86 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2495,7 +2495,7 @@ with pkgs; ioskeley-mono = recurseIntoAttrs (callPackage ../data/fonts/ioskeley-mono { }); - netbox_4_6 = netbox; + netbox_4_7 = netbox; netboxPlugins = recurseIntoAttrs netbox.plugins; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d7085e093a0f..89775c7dcd5c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4807,6 +4807,8 @@ self: super: with self; { django-pgtrigger = callPackage ../development/python-modules/django-pgtrigger { }; + django-pgware = callPackage ../development/python-modules/django-pgware { }; + django-phonenumber-field = callPackage ../development/python-modules/django-phonenumber-field { }; django-picklefield = callPackage ../development/python-modules/django-picklefield { };