From 0559e91c9cc3ce5208d75d4fb5d8e0d1ae2bfcd1 Mon Sep 17 00:00:00 2001 From: sinavir Date: Mon, 11 Nov 2024 00:57:08 +0100 Subject: [PATCH] chore(netbox): Upgrade --- machines/web01/netbox.nix | 2 +- patches/06-netbox-qrcode.patch | 70 ++++++++++++++++++++++++++++++++++ patches/default.nix | 11 ++---- 3 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 patches/06-netbox-qrcode.patch diff --git a/machines/web01/netbox.nix b/machines/web01/netbox.nix index 7c2157b..7d6f239 100644 --- a/machines/web01/netbox.nix +++ b/machines/web01/netbox.nix @@ -13,7 +13,7 @@ in services = { netbox = { enable = true; - package = nixpkgs.unstable.netbox_3_7; + package = nixpkgs.unstable.netbox_4_1; secretKeyFile = "/dev/null"; listenAddress = "127.0.0.1"; plugins = p: [ p.netbox-qrcode ]; diff --git a/patches/06-netbox-qrcode.patch b/patches/06-netbox-qrcode.patch new file mode 100644 index 0000000..73bfdc9 --- /dev/null +++ b/patches/06-netbox-qrcode.patch @@ -0,0 +1,70 @@ +diff --git a/pkgs/development/python-modules/netbox-qrcode/default.nix b/pkgs/development/python-modules/netbox-qrcode/default.nix +new file mode 100644 +index 000000000000..b378b839a8dc +--- /dev/null ++++ b/pkgs/development/python-modules/netbox-qrcode/default.nix +@@ -0,0 +1,51 @@ ++{ lib ++, buildPythonPackage ++, fetchFromGitHub ++, setuptools ++, wheel ++, pillow ++, qrcode ++, netbox ++}: ++ ++buildPythonPackage rec { ++ pname = "netbox-qrcode"; ++ version = "0.0.13"; ++ pyproject = true; ++ ++ src = fetchFromGitHub { ++ owner = "netbox-community"; ++ repo = "netbox-qrcode"; ++ rev = "v${version}"; ++ hash = "sha256-/labSZyB1SkU/uemuL946RDk8IVEAgCYJY2vrJFney0="; ++ }; ++ ++ nativeBuildInputs = [ ++ setuptools ++ wheel ++ ]; ++ ++ propagatedBuildInputs = [ ++ qrcode ++ pillow ++ ]; ++ ++ checkInputs = [ ++ netbox ++ ]; ++ ++ preFixup = '' ++ export PYTHONPATH=${netbox}/opt/netbox/netbox:$PYTHONPATH ++ ''; ++ ++ pythonImportsCheck = [ ++ "netbox_qrcode" ++ ]; ++ ++ meta = with lib; { ++ description = "NetBox Plugin for generate QR Codes"; ++ homepage = "https://github.com/netbox-community/netbox-qrcode"; ++ license = licenses.asl20; ++ maintainers = with maintainers; [ sinavir ]; ++ }; ++} +diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix +index 9999d745e3ac..b226e0063672 100644 +--- a/pkgs/top-level/python-packages.nix ++++ b/pkgs/top-level/python-packages.nix +@@ -8989,6 +8989,8 @@ self: super: with self; { + + netbox-reorder-rack = callPackage ../development/python-modules/netbox-reorder-rack { }; + ++ netbox-qrcode = callPackage ../development/python-modules/netbox-qrcode { }; ++ + netcdf4 = callPackage ../development/python-modules/netcdf4 { }; + + netdata = callPackage ../development/python-modules/netdata { }; diff --git a/patches/default.nix b/patches/default.nix index cf939c1..0cb2d81 100644 --- a/patches/default.nix +++ b/patches/default.nix @@ -1,10 +1,8 @@ { "nixos-24.05" = [ - # netbox qrcode plugin { - _type = "commit"; - sha = "c82191d848e7a37e125ee15c485f32ac01afc0b2"; - hash = "sha256-TooktlqihtULzJJsHvm8EubbUdJZvbDKdIDcYu7Qcig="; + _type = "static"; + path = ./06-netbox-qrcode.patch; } # nixos/nextcloud: Rename autocreate (a no-op) to verify_bucket_exists @@ -50,9 +48,8 @@ "nixos-unstable" = [ # netbox qrcode plugin { - _type = "commit"; - sha = "c82191d848e7a37e125ee15c485f32ac01afc0b2"; - hash = "sha256-TooktlqihtULzJJsHvm8EubbUdJZvbDKdIDcYu7Qcig="; + _type = "static"; + path = ./06-netbox-qrcode.patch; } # Build netbird-relay