nixos/netbox: don't force use of sudo in netbox-manage

This commit is contained in:
Taliyah Webb
2025-06-24 11:20:10 +02:00
parent 892300c9bd
commit 33ab0a191e
2 changed files with 10 additions and 1 deletions
@@ -54,6 +54,8 @@
- The `services.siproxd` module has been removed as `siproxd` is unmaintained and broken with libosip 5.x.
- `netbox-manage` script created by the `netbox` module no longer uses `sudo -u netbox` internally. It can be run as root and will change it's user to `netbox` using `runuser`
- `services.dwm-status.extraConfig` was replaced by [RFC0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md)-compliant [](#opt-services.dwm-status.settings), which is used to generate the config file. `services.dwm-status.order` is now moved to [](#opt-services.dwm-status.settings.order), as it's a part of the config file.
- `gitversion` was updated to 6.3.0, which includes a number of breaking changes, old configurations may need updating or they will cause the tool to fail to run.
+8 -1
View File
@@ -39,7 +39,14 @@ let
(writeScriptBin "netbox-manage" ''
#!${stdenv.shell}
export PYTHONPATH=${pkg.pythonPath}
sudo -u netbox ${pkg}/bin/netbox "$@"
case "$(whoami)" in
"root")
${util-linux}/bin/runuser -u netbox -- ${pkg}/bin/netbox "$@";;
"netbox")
${pkg}/bin/netbox "$@";;
*)
echo "This must be run by either by root 'netbox' user"
esac
'');
in