From 020fec7e8efe91b273893cc719a783680ff551cf Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 19 Oct 2024 16:00:30 -0500 Subject: [PATCH] feat: wiki test --- nixos/modules/services/postgresql.nix | 2 +- nixos/modules/services/wiki.nix | 47 +++++++++++++++++---------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/nixos/modules/services/postgresql.nix b/nixos/modules/services/postgresql.nix index afb20e0..818456b 100755 --- a/nixos/modules/services/postgresql.nix +++ b/nixos/modules/services/postgresql.nix @@ -6,7 +6,7 @@ in { postgresqlBackup = { enable = true; location = paths.path0; - databases = ["mastodon" "nextcloud" "peertube" "forgejo"]; + databases = ["mastodon" "nextcloud" "peertube" "forgejo" "wiki"]; }; postgresql = { enable = true; diff --git a/nixos/modules/services/wiki.nix b/nixos/modules/services/wiki.nix index 55ab246..fa4af80 100755 --- a/nixos/modules/services/wiki.nix +++ b/nixos/modules/services/wiki.nix @@ -13,11 +13,12 @@ in { services = { wiki-js = { enable = true; - environmentFile = config.sops.secrets."${name}-pass".path; + # environmentFile = config.sops.secrets."${name}-pass".path; settings = { port = ports.port0; bindIP = localhost; db = { + db = name; type = "postgres"; host = "/run/postgresql"; }; @@ -35,25 +36,35 @@ in { }; }; }; + + postgresql = { + ensureDatabases = [name]; + ensureUsers = [ + { + name = name; + ensureDBOwnership = true; + } + ]; + }; }; - sops = let - sopsSecrets = ["pass"]; - sopsPath = secret: { - path = "${sops.path0}/${name}-${secret}"; - owner = "root"; - mode = "600"; - }; - in { - secrets = builtins.listToAttrs ( - map - (secret: { - name = "${name}-${secret}"; - value = sopsPath secret; - }) - sopsSecrets - ); - }; + # sops = let + # sopsSecrets = ["pass"]; + # sopsPath = secret: { + # path = "${sops.path0}/${name}-${secret}"; + # owner = "root"; + # mode = "600"; + # }; + # in { + # secrets = builtins.listToAttrs ( + # map + # (secret: { + # name = "${name}-${secret}"; + # value = sopsPath secret; + # }) + # sopsSecrets + # ); + # }; fileSystems."/var/lib/${name}" = { device = paths.path0;