X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Ftools%2Fether%2Fdefault.nix;h=0539095e11e7c165b57d39272e25f754685f2381;hb=5315b439af1f72c3282549508ae58d86d66e38ec;hp=3e68d54e5ee2fbe3d4834f08fec4fa3a4ef019d3;hpb=17f6eae9907a122d4472da727ae8b1ac1c40c027;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/websites/tools/ether/default.nix b/modules/private/websites/tools/ether/default.nix index 3e68d54..0539095 100644 --- a/modules/private/websites/tools/ether/default.nix +++ b/modules/private/websites/tools/ether/default.nix @@ -1,6 +1,6 @@ -{ lib, pkgs, config, myconfig, ... }: +{ lib, pkgs, config, ... }: let - env = myconfig.env.tools.etherpad-lite; + env = config.myEnv.tools.etherpad-lite; cfg = config.myServices.websites.tools.etherpad-lite; # Make sure we’re not rebuilding whole libreoffice just because of a # dependency @@ -12,24 +12,23 @@ in { }; config = lib.mkIf cfg.enable { - 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}", @@ -55,7 +54,7 @@ in { "rtl": false, "alwaysShowChat": false, "chatAndUsers": false, - "lang": "en-gb" + "lang": "fr" }, "suppressErrorsInPadText" : false, @@ -66,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, @@ -83,21 +82,47 @@ in { "percentageToScrollWhenUserPressesArrowUp": 0 }, "users": { + "admin": { + "password": "${env.adminPassword}", + "is_admin": true + }, "ldapauth": { + "hash": "invalid", "url": "ldaps://${env.ldap.host}", "accountBase": "${env.ldap.base}", - "accountPattern": "(&(memberOf=cn=users,cn=etherpad,ou=services,dc=immae,dc=eu)(uid={{username}}))", + "accountPattern": "${env.ldap.filter}", "displayNameAttribute": "cn", - "searchDN": "cn=etherpad,ou=services,dc=immae,dc=eu", + "searchDN": "${env.ldap.dn}", "searchPWD": "${env.ldap.password}", "groupSearchBase": "${env.ldap.base}", "groupAttribute": "member", "groupAttributeIsDN": true, "searchScope": "sub", - "groupSearch": "(memberOf=cn=groups,cn=etherpad,ou=services,dc=immae,dc=eu)", + "groupSearch": "${env.ldap.group_filter}", "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, @@ -121,27 +146,38 @@ 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; paths = [ ecfg.sessionKeyFile ecfg.apiKeyFile ecfg.configFile ]; }; - services.websites.tools.modules = [ + services.websites.env.tools.modules = [ "headers" "proxy" "proxy_http" "proxy_wstunnel" ]; - services.websites.tools.vhostConfs.etherpad-lite = { + services.websites.env.tools.vhostConfs.etherpad-lite = { certName = "eldiron"; addToCerts = true; hosts = [ "ether.immae.eu" ]; @@ -152,7 +188,7 @@ in { RewriteEngine On - RewriteMap redirects "txt:${pkgs.writeText "redirects.txt" myconfig.env.tools.etherpad-lite.redirects}" + RewriteMap redirects "txt:${pkgs.writeText "redirects.txt" config.myEnv.tools.etherpad-lite.redirects}" RewriteCond %{QUERY_STRING} "!noredirect" RewriteCond %{REQUEST_URI} "^(.*)$" RewriteCond ''${redirects:$1|Unknown} "!Unknown"