From 94078428f180580c7ba33076ebba878a8028b47b Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 15 Aug 2021 22:57:36 +0000 Subject: [PATCH] bvm-netbox: add postgresql/redis/users --- ops/nixos/bvm-netbox/default.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ops/nixos/bvm-netbox/default.nix b/ops/nixos/bvm-netbox/default.nix index 5f6be657e0..6443121948 100644 --- a/ops/nixos/bvm-netbox/default.nix +++ b/ops/nixos/bvm-netbox/default.nix @@ -25,5 +25,29 @@ }; my.ip.tailscale = "100.81.27.52"; + services.postgresql = { + enable = true; + ensureDatabases = [ + "netbox" + ]; + ensureUsers = [{ + name = "netbox"; + ensurePermissions = { "DATABASE netbox" = "ALL PRIVILEGES"; }; + }]; + }; + services.postgresqlBackup.enable = true; + + services.redis = { + enable = true; + }; + + users.groups.netbox = {}; + users.users.netbox = { + home = "/srv/netbox"; + isSystemUser = true; + createHome = true; + group = "netbox"; + }; + system.stateVersion = "21.05"; }