f778fb131f
Some checks failed
build configuration / build_vault01 (push) Successful in 1m34s
build configuration / build_web02 (push) Successful in 1m35s
build configuration / build_storage01 (push) Successful in 1m57s
build configuration / build_rescue01 (push) Successful in 1m58s
lint / check (push) Failing after 27s
build configuration / build_compute01 (push) Successful in 2m2s
build configuration / build_web01 (push) Successful in 3m13s
54 lines
1.5 KiB
Nix
54 lines
1.5 KiB
Nix
{ config, pkgs, sources, lib, ... }:
|
|
{
|
|
services = {
|
|
netbox = {
|
|
enable = true;
|
|
package = (import sources.nixos-unstable {}).pkgs.netbox_3_7;
|
|
secretKeyFile = "/dev/null";
|
|
listenAddress = "127.0.0.1";
|
|
settings = {
|
|
ALLOWED_HOSTS = [ "netbox.dgnum.eu" ];
|
|
REMOTE_AUTH_BACKEND = "social_core.backends.open_id_connect.OpenIdConnectAuth";
|
|
};
|
|
|
|
extraConfig = lib.mkForce ''
|
|
from os import environ as env
|
|
|
|
SECRET_KEY = env["SECRET_KEY"]
|
|
|
|
SOCIAL_AUTH_OIDC_OIDC_ENDPOINT = env["NETBOX_OIDC_URL"]
|
|
SOCIAL_AUTH_OIDC_KEY = env["NETBOX_OIDC_KEY"]
|
|
SOCIAL_AUTH_OIDC_SECRET = env["NETBOX_OIDC_SECRET"]
|
|
'';
|
|
};
|
|
|
|
nginx = {
|
|
enable = true;
|
|
virtualHosts."netbox.dgnum.eu" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
|
|
locations."/".proxyPass = "http://${config.services.netbox.listenAddress}:${builtins.toString config.services.netbox.port}";
|
|
locations."/static/".alias = "${config.services.netbox.dataDir}/static/";
|
|
};
|
|
};
|
|
};
|
|
|
|
systemd.services.netbox.serviceConfig = {
|
|
TimeoutStartSec = 600;
|
|
EnvironmentFile = config.age.secrets.netbox_env.path;
|
|
};
|
|
|
|
systemd.services.netbox-housekeeping.serviceConfig = {
|
|
EnvironmentFile = config.age.secrets.netbox_env.path;
|
|
};
|
|
systemd.services.netbox-rq.serviceConfig = {
|
|
EnvironmentFile = config.age.secrets.netbox_env.path;
|
|
};
|
|
|
|
users.users.nginx.extraGroups = [ "netbox" ];
|
|
networking.firewall.allowedTCPPorts = [
|
|
443
|
|
80
|
|
];
|
|
}
|