aboutsummaryrefslogtreecommitdiff
path: root/modules/webapps
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webapps')
-rw-r--r--modules/webapps/etherpad-lite.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/webapps/etherpad-lite.nix b/modules/webapps/etherpad-lite.nix
index 3e951c5..7f0e2ed 100644
--- a/modules/webapps/etherpad-lite.nix
+++ b/modules/webapps/etherpad-lite.nix
@@ -26,6 +26,13 @@ in
26 The directory where Etherpad lite stores its data. 26 The directory where Etherpad lite stores its data.
27 ''; 27 '';
28 }; 28 };
29 socketsDir = lib.mkOption {
30 type = lib.types.path;
31 default = "/run/${name}";
32 description = ''
33 The directory where Etherpad lite stores its sockets.
34 '';
35 };
29 configFile = lib.mkOption { 36 configFile = lib.mkOption {
30 type = lib.types.path; 37 type = lib.types.path;
31 description = '' 38 description = ''
@@ -77,6 +84,26 @@ in
77 ''; 84 '';
78 readOnly = true; 85 readOnly = true;
79 }; 86 };
87 systemdRuntimeDirectory = lib.mkOption {
88 type = lib.types.str;
89 # Use ReadWritePaths= instead if socketsDir is outside of /run
90 default = assert lib.strings.hasPrefix "/run/" cfg.socketsDir;
91 lib.strings.removePrefix "/run/" cfg.socketsDir;
92 description = ''
93 Adjusted Etherpad lite sockets directory for systemd
94 '';
95 readOnly = true;
96 };
97 sockets = lib.mkOption {
98 type = lib.types.attrsOf lib.types.path;
99 default = {
100 node = "${cfg.socketsDir}/etherpad-lite.sock";
101 };
102 readOnly = true;
103 description = ''
104 Etherpad lite sockets
105 '';
106 };
80 }; 107 };
81 108
82 config = lib.mkIf cfg.enable { 109 config = lib.mkIf cfg.enable {
@@ -98,6 +125,12 @@ in
98 --settings ${cfg.configFile} 125 --settings ${cfg.configFile}
99 ''; 126 '';
100 127
128 postStart = ''
129 while [ ! -S ${cfg.sockets.node} ]; do
130 sleep 0.5
131 done
132 chmod a+w ${cfg.sockets.node}
133 '';
101 serviceConfig = { 134 serviceConfig = {
102 DynamicUser = true; 135 DynamicUser = true;
103 User = cfg.user; 136 User = cfg.user;
@@ -112,6 +145,7 @@ in
112 Restart = "always"; 145 Restart = "always";
113 Type = "simple"; 146 Type = "simple";
114 TimeoutSec = 60; 147 TimeoutSec = 60;
148 RuntimeDirectory = cfg.systemdRuntimeDirectory;
115 StateDirectory= cfg.systemdStateDirectory; 149 StateDirectory= cfg.systemdStateDirectory;
116 ExecStartPre = [ 150 ExecStartPre = [
117 "+${pkgs.coreutils}/bin/install -d -m 0755 -o ${cfg.user} -g ${cfg.group} ${cfg.dataDir}/ep_initialized" 151 "+${pkgs.coreutils}/bin/install -d -m 0755 -o ${cfg.user} -g ${cfg.group} ${cfg.dataDir}/ep_initialized"