]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/mgoblin/default.nix
Use new withPlugin system
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / mgoblin / default.nix
index b99b95e982ed601853e675d2e11f8e87b3e43a71..719d3d3595d9b59689661a81efbe83e63db8abcb 100644 (file)
@@ -1,6 +1,6 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
-  env = myconfig.env.tools.mediagoblin;
+  env = config.myEnv.tools.mediagoblin;
   cfg = config.myServices.websites.tools.mediagoblin;
   mcfg = config.services.mediagoblin;
 in {
@@ -9,12 +9,20 @@ in {
   };
 
   config = lib.mkIf cfg.enable {
+    services.duplyBackup.profiles.mgoblin = {
+      rootDir = mcfg.dataDir;
+    };
     secrets.keys = [{
       dest = "webapps/tools-mediagoblin";
       user = "mediagoblin";
       group = "mediagoblin";
       permissions = "0400";
-      text = ''
+      text =
+        let
+          psql_url = with env.postgresql; "postgresql://${user}:${password}@:${port}/${database}?host=${socket}";
+          redis_url = with env.redis; "redis+socket://${socket}?virtual_host=${db}";
+        in
+      ''
         [DEFAULT]
         data_basedir = "${mcfg.dataDir}"
 
@@ -23,7 +31,7 @@ in {
         email_sender_address = "mediagoblin@tools.immae.eu"
 
         #sql_engine = sqlite:///%(data_basedir)s/mediagoblin.db
-        sql_engine = ${env.psql_url}
+        sql_engine = ${psql_url}
 
         email_debug_mode = false
         allow_registration = false
@@ -49,19 +57,19 @@ in {
         base_url = /mgoblin_media/
 
         [celery]
-        CELERY_RESULT_DBURI = ${env.redis_url}
-        BROKER_URL = ${env.redis_url}
+        CELERY_RESULT_DBURI = ${redis_url}
+        BROKER_URL = ${redis_url}
         CELERYD_CONCURRENCY = 1
 
         [plugins]
           [[mediagoblin.plugins.geolocation]]
           [[mediagoblin.plugins.ldap]]
             [[[immae.eu]]]
-              LDAP_SERVER_URI = 'ldaps://ldap.immae.eu:636'
-              LDAP_SEARCH_BASE = 'dc=immae,dc=eu'
-              LDAP_BIND_DN = 'cn=mediagoblin,ou=services,dc=immae,dc=eu'
+              LDAP_SERVER_URI = 'ldaps://${env.ldap.host}:636'
+              LDAP_SEARCH_BASE = '${env.ldap.base}'
+              LDAP_BIND_DN = '${env.ldap.dn}'
               LDAP_BIND_PW = '${env.ldap.password}'
-              LDAP_SEARCH_FILTER = '(&(memberOf=cn=users,cn=mediagoblin,ou=services,dc=immae,dc=eu)(uid={username}))'
+              LDAP_SEARCH_FILTER = '${env.ldap.filter}'
               EMAIL_SEARCH_FIELD = 'mail'
           [[mediagoblin.plugins.basicsearch]]
           [[mediagoblin.plugins.piwigo]]
@@ -75,7 +83,7 @@ in {
 
     services.mediagoblin = {
       enable     = true;
-      plugins    = builtins.attrValues pkgs.webapps.mediagoblin-plugins;
+      package    = pkgs.webapps.mediagoblin.withPlugins (p: [p.basicsearch]);
       configFile = "/var/secrets/webapps/tools-mediagoblin";
     };
     services.filesWatcher.mediagoblin-web = {