Tom Hubrecht
158e9647bd
All checks were successful
build configuration / build_rescue01 (push) Successful in 1m6s
build configuration / build_vault01 (push) Successful in 1m8s
build configuration / build_storage01 (push) Successful in 1m8s
build configuration / build_compute01 (push) Successful in 1m16s
build configuration / build_web02 (push) Successful in 1m18s
lint / check (push) Successful in 23s
build configuration / build_web01 (push) Successful in 2m2s
79 lines
1.8 KiB
Nix
79 lines
1.8 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
nixpkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
EnvironmentFile = [ config.age.secrets."netbox-environment_file".path ];
|
|
in
|
|
|
|
{
|
|
services = {
|
|
netbox = {
|
|
enable = true;
|
|
package = nixpkgs.unstable.netbox_3_7;
|
|
secretKeyFile = "/dev/null";
|
|
listenAddress = "127.0.0.1";
|
|
plugins = p: [ p.netbox-qrcode ];
|
|
settings = {
|
|
ALLOWED_HOSTS = [ "netbox.dgnum.eu" ];
|
|
REMOTE_AUTH_BACKEND = "social_core.backends.open_id_connect.OpenIdConnectAuth";
|
|
PLUGINS = [ "netbox_qrcode" ];
|
|
PLUGINS_CONFIG = {
|
|
netbox_qrcode = {
|
|
custom_text = "DGNum. contact@dgnum.eu";
|
|
font = "Tahoma";
|
|
};
|
|
};
|
|
};
|
|
|
|
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 = {
|
|
inherit EnvironmentFile;
|
|
|
|
TimeoutStartSec = 600;
|
|
};
|
|
|
|
netbox-housekeeping.serviceConfig = {
|
|
inherit EnvironmentFile;
|
|
};
|
|
|
|
netbox-rq.serviceConfig = {
|
|
inherit EnvironmentFile;
|
|
};
|
|
};
|
|
|
|
users.users.nginx.extraGroups = [ "netbox" ];
|
|
networking.firewall.allowedTCPPorts = [
|
|
443
|
|
80
|
|
];
|
|
|
|
dgn-backups.jobs.netbox.settings.paths = [ "/var/lib/netbox" ];
|
|
dgn-backups.postgresDatabases = [ "netbox" ];
|
|
}
|