]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/mastodon/default.nix
Add specification for the private config file as a module.
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / mastodon / default.nix
index 1a4b387c769a3cd55cf568afd7181dbbc4de1186..80d74318daef949fc1aa3eeeb080fbbdefe8dfc3 100644 (file)
@@ -1,6 +1,6 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
-  env = myconfig.env.tools.mastodon;
+  env = config.myEnv.tools.mastodon;
   root = "/run/current-system/webapps/tools_mastodon";
   cfg = config.myServices.websites.tools.mastodon;
   mcfg = config.services.mastodon;
@@ -10,6 +10,9 @@ in {
   };
 
   config = lib.mkIf cfg.enable {
+    services.duplyBackup.profiles.mastodon = {
+      rootDir = mcfg.dataDir;
+    };
     secrets.keys = [{
       dest = "webapps/tools-mastodon";
       user = "mastodon";
@@ -47,14 +50,14 @@ in {
 
         # LDAP authentication (optional)
         LDAP_ENABLED=true
-        LDAP_HOST=ldap.immae.eu
+        LDAP_HOST=${env.ldap.host}
         LDAP_PORT=636
         LDAP_METHOD=simple_tls
-        LDAP_BASE="dc=immae,dc=eu"
-        LDAP_BIND_DN="cn=mastodon,ou=services,dc=immae,dc=eu"
+        LDAP_BASE="${env.ldap.base}"
+        LDAP_BIND_DN="${env.ldap.dn}"
         LDAP_PASSWORD="${env.ldap.password}"
         LDAP_UID="uid"
-        LDAP_SEARCH_FILTER="(&(%{uid}=%{email})(memberOf=cn=users,cn=mastodon,ou=services,dc=immae,dc=eu))"
+        LDAP_SEARCH_FILTER="${env.ldap.filter}"
       '';
     }];
     services.mastodon = {
@@ -77,14 +80,14 @@ in {
     };
 
 
-    services.websites.tools.modules = [
+    services.websites.env.tools.modules = [
       "headers" "proxy" "proxy_wstunnel" "proxy_http"
     ];
     system.extraSystemBuilderCmds = ''
       mkdir -p $out/webapps
       ln -s ${mcfg.workdir}/public/ $out/webapps/tools_mastodon
       '';
-    services.websites.tools.vhostConfs.mastodon = {
+    services.websites.env.tools.vhostConfs.mastodon = {
       certName    = "eldiron";
       addToCerts  = true;
       hosts       = ["mastodon.immae.eu" ];