nixos/netbox: allow opt-out from local postgres and redis

This is important, because now users can easily understand that the
module takes care of these things, and opt-out if needed.
This commit is contained in:
Martin Weinelt
2026-07-07 17:43:38 +02:00
parent 4d576c4839
commit 5bab8a265b
+21 -2
View File
@@ -392,6 +392,25 @@ in
'';
};
redis.createLocally = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable and set up a Redis database for NetBox locally.
'';
};
postgresql.createLocally = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable and set up PostgreSQL locally.
This will automatically created a database and a local user, that can
authenticate over Unix domain sockets with `SO_PEERCRED`.
'';
};
package = lib.mkOption {
type = types.package;
default =
@@ -523,9 +542,9 @@ in
config = lib.mkIf cfg.enable {
services.netbox.plugins = lib.mkIf enableLDAP (ps: [ ps.django-auth-ldap ]);
services.redis.servers.netbox.enable = true;
services.redis.servers.netbox.enable = cfg.redis.createLocally;
services.postgresql = {
services.postgresql = lib.mkIf cfg.postgresql.createLocally {
enable = true;
ensureDatabases = [ "netbox" ];
ensureUsers = [