aboutsummaryrefslogtreecommitdiff
path: root/nixops
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-09 10:03:16 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-09 10:56:07 +0200
commit1247e537b0c8e5ed780ab890cbce4612714a0fa7 (patch)
treec5160a45367b8c7dd4f8b5d9162d908517da041e /nixops
parent803d2d9f35005f10eb43e4568b7f0444d3f9d6aa (diff)
downloadNix-1247e537b0c8e5ed780ab890cbce4612714a0fa7.tar.gz
Nix-1247e537b0c8e5ed780ab890cbce4612714a0fa7.tar.zst
Nix-1247e537b0c8e5ed780ab890cbce4612714a0fa7.zip
Make etherpad derivation pure
It also moves .ep_initialized to /var/lib to allow proper initialization.
Diffstat (limited to 'nixops')
-rw-r--r--nixops/modules/websites/tools/ether/default.nix10
-rw-r--r--nixops/modules/websites/tools/ether/etherpad_lite.nix5
2 files changed, 10 insertions, 5 deletions
diff --git a/nixops/modules/websites/tools/ether/default.nix b/nixops/modules/websites/tools/ether/default.nix
index 09e5c9d..c4685a4 100644
--- a/nixops/modules/websites/tools/ether/default.nix
+++ b/nixops/modules/websites/tools/ether/default.nix
@@ -5,6 +5,7 @@ let
5 env = myconfig.env.tools.etherpad-lite; 5 env = myconfig.env.tools.etherpad-lite;
6 }; 6 };
7 7
8 varDir = etherpad.webappDir.varDir;
8 cfg = config.services.myWebsites.tools.etherpad-lite; 9 cfg = config.services.myWebsites.tools.etherpad-lite;
9in { 10in {
10 options.services.myWebsites.tools.etherpad-lite = { 11 options.services.myWebsites.tools.etherpad-lite = {
@@ -26,6 +27,8 @@ in {
26 27
27 script = '' 28 script = ''
28 exec ${pkgs.nodejs}/bin/node ${etherpad.webappDir}/src/node/server.js \ 29 exec ${pkgs.nodejs}/bin/node ${etherpad.webappDir}/src/node/server.js \
30 --sessionkey /var/secrets/webapps/tools-etherpad-sessionkey \
31 --apikey /var/secrets/webapps/tools-etherpad-apikey \
29 --settings /var/secrets/webapps/tools-etherpad 32 --settings /var/secrets/webapps/tools-etherpad
30 ''; 33 '';
31 34
@@ -44,7 +47,12 @@ in {
44 Restart = "always"; 47 Restart = "always";
45 Type = "simple"; 48 Type = "simple";
46 TimeoutSec = 60; 49 TimeoutSec = 60;
47 ExecStartPre = "+${pkgs.coreutils}/bin/chown -R etherpad-lite:etherpad-lite /var/secrets/webapps/tools-etherpad /var/secrets/webapps/tools-etherpad-sessionkey /var/secrets/webapps/tools-etherpad-apikey"; 50 # Use ReadWritePaths= instead if varDir is outside of /var/lib
51 StateDirectory="etherpad-lite";
52 ExecStartPre = [
53 "+${pkgs.coreutils}/bin/install -d -m 0755 -o etherpad-lite -g etherpad-lite ${varDir}/ep_initialized"
54 "+${pkgs.coreutils}/bin/chown -R etherpad-lite:etherpad-lite ${varDir} /var/secrets/webapps/tools-etherpad /var/secrets/webapps/tools-etherpad-sessionkey /var/secrets/webapps/tools-etherpad-apikey"
55 ];
48 }; 56 };
49 }; 57 };
50 58
diff --git a/nixops/modules/websites/tools/ether/etherpad_lite.nix b/nixops/modules/websites/tools/ether/etherpad_lite.nix
index 35220ee..c6f3704 100644
--- a/nixops/modules/websites/tools/ether/etherpad_lite.nix
+++ b/nixops/modules/websites/tools/ether/etherpad_lite.nix
@@ -119,10 +119,7 @@ let
119 ''; 119 '';
120 } 120 }
121 ]; 121 ];
122 webappDir = (etherpad-lite.override { 122 webappDir = etherpad-lite.withModules (builtins.attrValues etherpad-lite-modules);
123 session_key = "/var/secrets/webapps/tools-etherpad-sessionkey";
124 api_key = "/var/secrets/webapps/tools-etherpad-apikey";
125 }).withModules etherpad-lite-modules;
126in 123in
127 { 124 {
128 inherit webappDir keys listenPort; 125 inherit webappDir keys listenPort;