From 0d3b83267a57da12a2624df947b7fea101ed8554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Barnouin?= Date: Tue, 24 Sep 2024 15:54:59 +0200 Subject: [PATCH] Add Netbox service --- services/netbox/default.nix | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 services/netbox/default.nix diff --git a/services/netbox/default.nix b/services/netbox/default.nix new file mode 100644 index 0000000..ca9a1f4 --- /dev/null +++ b/services/netbox/default.nix @@ -0,0 +1,57 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.services.vm_netbox; +in +{ + options.services.vm_netbox = { + enable = lib.mkEnableOption "Enable minimal config"; + db_ip = lib.mkOption { + type = lib.types.str; + description = "netbox database IP address"; + }; + }; + config = lib.mkIf cfg.enable { + services.netbox = { + enable = true; + port = 8001; + settings = { + ALLOWED_HOSTS = [ "*" ], + DATABASE = { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'netbox', + 'USER': 'netbox', + 'PASSWORD': 'Netbox43Zer!', + 'HOST': '192.168.1.13', + 'PORT': '5432', + 'CONN_MAX_AGE': 300, + }, + REDIS = { + 'tasks': { + 'HOST': '192.168.1.16', + 'PORT': 6379, + 'USERNAME': '', + 'PASSWORD': '', + 'DATABASE': 0, + 'SSL': False, + }, + 'caching': { + 'HOST': '192.168.1.16', + 'PORT': 6379, + 'USERNAME': '', + 'PASSWORD': '', + 'DATABASE': 1, + 'SSL': False, + } + }, + CSRF_COOKIE_NAME = 'csrftoken', + CSRF_TRUSTED_ORIGINS = ( + 'http://192.168.1.40', + 'https://netbox.le43.eu', + ), + DEBUG = False + }; + secretKeyFile = "/run/secrets/netbox/keyFile"; + }; + networking.firewall.allowedTCPPorts = [ 8001 ]; + }; +}