working netbox

This commit is contained in:
TheWanderingCrow 2025-08-13 15:55:48 -04:00
parent 2333647240
commit 70f02c59df
2 changed files with 17 additions and 5 deletions

View file

@ -1,19 +1,27 @@
{
inputs,
config,
pkgs,
...
}: {
}: let
sopsFolder = builtins.toString inputs.nix-secrets + "/sops";
in {
users.users.nginx.extraGroups = ["netbox"];
sops.secrets."netbox/secret-key" = {};
sops.secrets."netbox/secret-key" = {
owner = "netbox";
sopsFile = "${sopsFolder}/shared.yaml";
};
services.nginx = {
enable = true;
recommendedProxySettings = true; # otherwise you will get CSRF error while login
virtualHosts."netbox.wanderingcrow.net" = {
forceSSL = true;
useACMEHost = "netbox.wanderingcrow.net";
locations = {
"/" = {
proxyPass = "/run/netbox/netbox.sock";
proxyPass = "http://${config.services.netbox.listenAddress}:${builtins.toString config.services.netbox.port}";
};
"/static/" = {alias = "${config.services.netbox.dataDir}/static/";};
};
@ -21,8 +29,10 @@
};
services.netbox = {
enabled = true;
unixSocket = "/run/netbox/netbox.sock";
enable = true;
package = pkgs.netbox;
listenAddress = "0.0.0.0";
port = 9099;
secretKeyFile = config.sops.secrets."netbox/secret-key".path;
};
}