]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/ether/default.nix
Remove duply-backup
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / ether / default.nix
index 1c56ed7a2fc6ed77f18c6e5a145b12ce425dfda7..0539095e11e7c165b57d39272e25f754685f2381 100644 (file)
@@ -12,27 +12,23 @@ in {
   };
 
   config = lib.mkIf cfg.enable {
-    services.duplyBackup.profiles.etherpad-lite = {
-      rootDir = "/var/lib/private/etherpad-lite";
-    };
-    secrets.keys = [
-      {
-        dest = "webapps/tools-etherpad-apikey";
+    secrets.keys = {
+      "webapps/tools-etherpad-apikey" = {
         permissions = "0400";
         text = env.api_key;
-      }
-      {
-        dest = "webapps/tools-etherpad-sessionkey";
+      };
+      "webapps/tools-etherpad-sessionkey" = {
         permissions = "0400";
         text = env.session_key;
-      }
-      {
-        dest = "webapps/tools-etherpad";
+      };
+      "webapps/tools-etherpad" = {
         permissions = "0400";
         text = ''
           {
             "title": "Etherpad",
             "favicon": "favicon.ico",
+            "skinName": "colibris",
+            "skinVariants": "dark-toolbar light-background super-light-editor full-width-editor",
 
             "ip": "",
             "port" : "${ecfg.sockets.node}",
@@ -58,7 +54,7 @@ in {
               "rtl": false,
               "alwaysShowChat": false,
               "chatAndUsers": false,
-              "lang": "en-gb"
+              "lang": "fr"
             },
 
             "suppressErrorsInPadText" : false,
@@ -69,7 +65,7 @@ in {
             "maxAge" : 21600,
             "abiword" : null,
             "soffice" : "${libreoffice}/bin/soffice",
-            "tidyHtml" : "${pkgs.html-tidy}/bin/tidy",
+            "tidyHtml" : "",
             "allowUnknownFileEnds" : true,
             "requireAuthentication" : false,
             "requireAuthorization" : false,
@@ -86,7 +82,12 @@ in {
               "percentageToScrollWhenUserPressesArrowUp": 0
             },
             "users": {
+              "admin": {
+                "password": "${env.adminPassword}",
+                "is_admin": true
+              },
               "ldapauth": {
+                "hash": "invalid",
                 "url": "ldaps://${env.ldap.host}",
                 "accountBase": "${env.ldap.base}",
                 "accountPattern": "${env.ldap.filter}",
@@ -101,6 +102,27 @@ in {
                 "anonymousReadonly": false
               }
             },
+            "ep_mypads": {
+              "warning": "This hash is stored in database, changing anything here will not have any consequence",
+              "ldap": {
+                "url": "ldaps://${env.ldap.host}",
+                "bindDN": "${env.ldap.dn}",
+                "bindCredentials": "${env.ldap.password}",
+                "searchBase": "${env.ldap.base}",
+                "searchFilter": "${env.ldap.filter}",
+                "properties": {
+                  "login": "uid",
+                  "email": "mail",
+                  "firstname": "givenName",
+                  "lastname": "sn"
+                },
+                "defaultLang": "fr"
+              }
+            },
+            "ep_comments_page": {
+              "displayCommentAsIcon": true,
+              "highlightSelectedText": true
+            },
             "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
             "loadTest": false,
             "indentationOnNewLine": false,
@@ -124,17 +146,28 @@ in {
             "logconfig" : { "appenders": [ { "type": "console" } ] }
           }
         '';
-      }
-    ];
+      };
+    };
     services.etherpad-lite = {
       enable = true;
-      modules = builtins.attrValues pkgs.webapps.etherpad-lite-modules;
-      sessionKeyFile = "/var/secrets/webapps/tools-etherpad-sessionkey";
-      apiKeyFile = "/var/secrets/webapps/tools-etherpad-apikey";
-      configFile = "/var/secrets/webapps/tools-etherpad";
+      package = pkgs.webapps.etherpad-lite.withModules (p: [
+        p.ep_align p.ep_bookmark p.ep_colors p.ep_comments_page
+        p.ep_cursortrace p.ep_delete_empty_pads p.ep_embedmedia
+        p.ep_font_size p.ep_headings2 p.ep_immae_buttons p.ep_ldapauth
+        p.ep_line_height p.ep_markdown p.ep_mypads p.ep_page_view
+        p.ep_previewimages p.ep_ruler p.ep_scrollto
+        p.ep_set_title_on_pad p.ep_subscript_and_superscript
+        p.ep_timesliderdiff
+      ]);
+      modules = [];
+      sessionKeyFile = config.secrets.fullPaths."webapps/tools-etherpad-sessionkey";
+      apiKeyFile = config.secrets.fullPaths."webapps/tools-etherpad-apikey";
+      configFile = config.secrets.fullPaths."webapps/tools-etherpad";
     };
 
     systemd.services.etherpad-lite.serviceConfig.SupplementaryGroups = "keys";
+    # Needed so that they get in the closure
+    systemd.services.etherpad-lite.path = [ libreoffice pkgs.html-tidy ];
 
     services.filesWatcher.etherpad-lite = {
       restart = true;