X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fwebapps%2Fetherpad-lite.nix;h=2e0995287e7f07074ebc7dfdf1694f383a851aa3;hb=fa25ffd4583cc362075cd5e1b4130f33306103f0;hp=3e951c5118bb10022b7c2096579b958e721ed998;hpb=742c28ad92467859fb7f54c4b8b4d09d9864a75e;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/webapps/etherpad-lite.nix b/modules/webapps/etherpad-lite.nix index 3e951c5..2e09952 100644 --- a/modules/webapps/etherpad-lite.nix +++ b/modules/webapps/etherpad-lite.nix @@ -26,6 +26,13 @@ in The directory where Etherpad lite stores its data. ''; }; + socketsDir = lib.mkOption { + type = lib.types.path; + default = "/run/${name}"; + description = '' + The directory where Etherpad lite stores its sockets. + ''; + }; configFile = lib.mkOption { type = lib.types.path; description = '' @@ -50,18 +57,22 @@ in description = '' Etherpad lite package to use. ''; + example = lib.literalExample '' + pkgs.webapps.etherpad-lite.withModules (p: [ p.ep_align ]); + ''; }; modules = lib.mkOption { type = lib.types.listOf lib.types.package; default = []; description = '' Etherpad lite modules to use. + DEPRECATED: use package directly ''; }; # Output variables workdir = lib.mkOption { type = lib.types.package; - default = cfg.package.withModules cfg.modules; + default = cfg.package.withModules (_: cfg.modules); description = '' Adjusted Etherpad lite package with plugins ''; @@ -77,6 +88,26 @@ in ''; readOnly = true; }; + systemdRuntimeDirectory = lib.mkOption { + type = lib.types.str; + # Use ReadWritePaths= instead if socketsDir is outside of /run + default = assert lib.strings.hasPrefix "/run/" cfg.socketsDir; + lib.strings.removePrefix "/run/" cfg.socketsDir; + description = '' + Adjusted Etherpad lite sockets directory for systemd + ''; + readOnly = true; + }; + sockets = lib.mkOption { + type = lib.types.attrsOf lib.types.path; + default = { + node = "${cfg.socketsDir}/etherpad-lite.sock"; + }; + readOnly = true; + description = '' + Etherpad lite sockets + ''; + }; }; config = lib.mkIf cfg.enable { @@ -98,6 +129,12 @@ in --settings ${cfg.configFile} ''; + postStart = '' + while [ ! -S ${cfg.sockets.node} ]; do + sleep 0.5 + done + chmod a+w ${cfg.sockets.node} + ''; serviceConfig = { DynamicUser = true; User = cfg.user; @@ -112,6 +149,7 @@ in Restart = "always"; Type = "simple"; TimeoutSec = 60; + RuntimeDirectory = cfg.systemdRuntimeDirectory; StateDirectory= cfg.systemdStateDirectory; ExecStartPre = [ "+${pkgs.coreutils}/bin/install -d -m 0755 -o ${cfg.user} -g ${cfg.group} ${cfg.dataDir}/ep_initialized"