aboutsummaryrefslogtreecommitdiff
path: root/nixops
diff options
context:
space:
mode:
Diffstat (limited to 'nixops')
-rw-r--r--nixops/modules/websites/tools/tools/default.nix11
-rw-r--r--nixops/modules/websites/tools/tools/kanboard.json15
-rw-r--r--nixops/modules/websites/tools/tools/kanboard.nix86
3 files changed, 111 insertions, 1 deletions
diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix
index 3b49077..076d465 100644
--- a/nixops/modules/websites/tools/tools/default.nix
+++ b/nixops/modules/websites/tools/tools/default.nix
@@ -9,6 +9,10 @@ let
9 env = myconfig.env.tools.ttrss; 9 env = myconfig.env.tools.ttrss;
10 }; 10 };
11 roundcubemail = pkgs.callPackage ./roundcubemail.nix { env = myconfig.env.tools.roundcubemail; }; 11 roundcubemail = pkgs.callPackage ./roundcubemail.nix { env = myconfig.env.tools.roundcubemail; };
12 kanboard = pkgs.callPackage ./kanboard.nix {
13 inherit (mylibs) fetchedGithub;
14 env = myconfig.env.tools.kanboard;
15 };
12 wallabag = pkgs.callPackage ./wallabag.nix { env = myconfig.env.tools.wallabag; }; 16 wallabag = pkgs.callPackage ./wallabag.nix { env = myconfig.env.tools.wallabag; };
13 yourls = pkgs.callPackage ./yourls.nix { 17 yourls = pkgs.callPackage ./yourls.nix {
14 inherit (mylibs) fetchedGithub; 18 inherit (mylibs) fetchedGithub;
@@ -48,7 +52,8 @@ in {
48 ++ rompr.apache.modules 52 ++ rompr.apache.modules
49 ++ shaarli.apache.modules 53 ++ shaarli.apache.modules
50 ++ dokuwiki.apache.modules 54 ++ dokuwiki.apache.modules
51 ++ ldap.apache.modules; 55 ++ ldap.apache.modules
56 ++ kanboard.apache.modules;
52 57
53 services.ympd = ympd.config // { enable = true; }; 58 services.ympd = ympd.config // { enable = true; };
54 59
@@ -77,6 +82,7 @@ in {
77 shaarli.apache.vhostConf 82 shaarli.apache.vhostConf
78 dokuwiki.apache.vhostConf 83 dokuwiki.apache.vhostConf
79 ldap.apache.vhostConf 84 ldap.apache.vhostConf
85 kanboard.apache.vhostConf
80 ]; 86 ];
81 }; 87 };
82 88
@@ -116,6 +122,7 @@ in {
116 shaarli = shaarli.phpFpm.pool; 122 shaarli = shaarli.phpFpm.pool;
117 dokuwiki = dokuwiki.phpFpm.pool; 123 dokuwiki = dokuwiki.phpFpm.pool;
118 ldap = ldap.phpFpm.pool; 124 ldap = ldap.phpFpm.pool;
125 kanboard = kanboard.phpFpm.pool;
119 tools = '' 126 tools = ''
120 listen = /var/run/phpfpm/tools.sock 127 listen = /var/run/phpfpm/tools.sock
121 user = wwwrun 128 user = wwwrun
@@ -142,6 +149,7 @@ in {
142 rompr = rompr.activationScript; 149 rompr = rompr.activationScript;
143 shaarli = shaarli.activationScript; 150 shaarli = shaarli.activationScript;
144 dokuwiki = dokuwiki.activationScript; 151 dokuwiki = dokuwiki.activationScript;
152 kanboard = kanboard.activationScript;
145 }; 153 };
146 154
147 system.extraSystemBuilderCmds = '' 155 system.extraSystemBuilderCmds = ''
@@ -154,6 +162,7 @@ in {
154 ln -s ${ttrss.webRoot} $out/webapps/${ttrss.apache.webappName} 162 ln -s ${ttrss.webRoot} $out/webapps/${ttrss.apache.webappName}
155 ln -s ${wallabag.webRoot} $out/webapps/${wallabag.apache.webappName} 163 ln -s ${wallabag.webRoot} $out/webapps/${wallabag.apache.webappName}
156 ln -s ${yourls.webRoot} $out/webapps/${yourls.apache.webappName} 164 ln -s ${yourls.webRoot} $out/webapps/${yourls.apache.webappName}
165 ln -s ${kanboard.webRoot} $out/webapps/${kanboard.apache.webappName}
157 ''; 166 '';
158 167
159 nixpkgs.overlays = [ (self: super: rec { 168 nixpkgs.overlays = [ (self: super: rec {
diff --git a/nixops/modules/websites/tools/tools/kanboard.json b/nixops/modules/websites/tools/tools/kanboard.json
new file mode 100644
index 0000000..5b1d115
--- /dev/null
+++ b/nixops/modules/websites/tools/tools/kanboard.json
@@ -0,0 +1,15 @@
1{
2 "tag": "v1.2.9",
3 "meta": {
4 "name": "kanboard",
5 "url": "https://github.com/kanboard/kanboard/",
6 "branch": "refs/tags/v1.2.9"
7 },
8 "github": {
9 "owner": "kanboard",
10 "repo": "kanboard",
11 "rev": "c4152316b14936556edf3bcc4d11f16ba31b8ae7",
12 "sha256": "18bn9zhyfc5x28hwcxss7chdq7c8rshc8jxgai65i5l68iwhvjg7",
13 "fetchSubmodules": true
14 }
15}
diff --git a/nixops/modules/websites/tools/tools/kanboard.nix b/nixops/modules/websites/tools/tools/kanboard.nix
new file mode 100644
index 0000000..399d3e1
--- /dev/null
+++ b/nixops/modules/websites/tools/tools/kanboard.nix
@@ -0,0 +1,86 @@
1{ lib, env, fetchedGithub, writeText, stdenv, fetchurl }:
2rec {
3 varDir = "/var/lib/kanboard";
4 activationScript = {
5 deps = [ "wrappers" ];
6 text = ''
7 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/data
8 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
9 install -TDm644 ${webRoot}/dataold/.htaccess ${varDir}/data/.htaccess
10 install -TDm644 ${webRoot}/dataold/web.config ${varDir}/data/web.config
11 '';
12 };
13 config = writeText "config.php" ''
14 <?php
15 define('MAIL_FROM', 'kanboard@immae.eu');
16
17 define('DB_DRIVER', 'postgres');
18 define('DB_USERNAME', '${env.postgresql.user}');
19 define('DB_PASSWORD', '${env.postgresql.password}');
20 define('DB_HOSTNAME', '${env.postgresql.socket}');
21 define('DB_NAME', '${env.postgresql.database}');
22
23 define('LDAP_AUTH', true);
24 define('LDAP_SERVER', '${env.ldap.host}');
25 define('LDAP_START_TLS', true);
26
27 define('LDAP_BIND_TYPE', 'proxy');
28 define('LDAP_USERNAME', '${env.ldap.dn}');
29 define('LDAP_PASSWORD', '${env.ldap.password}');
30 define('LDAP_USER_BASE_DN', '${env.ldap.base}');
31 define('LDAP_USER_FILTER', '(&(memberOf=cn=users,cn=kanboard,ou=services,dc=immae,dc=eu)(uid=%s))');
32 define('LDAP_GROUP_ADMIN_DN', 'cn=admins,cn=kanboard,ou=services,dc=immae,dc=eu');
33 ?>
34 '';
35 webRoot = stdenv.mkDerivation (fetchedGithub ./kanboard.json // rec {
36 dontBuild = true;
37 installPhase = ''
38 cp -a . $out
39 ln -s ${config} $out/config.php
40 mv $out/data $out/dataold
41 ln -s ${varDir}/data $out/data
42 '';
43 });
44 apache = rec {
45 user = "wwwrun";
46 group = "wwwrun";
47 modules = [ "proxy_fcgi" ];
48 webappName = "tools_kanboard";
49 root = "/run/current-system/webapps/${webappName}";
50 vhostConf = ''
51 Alias /kanboard "${root}"
52 <Directory "${root}">
53 DirectoryIndex index.php
54 AllowOverride All
55 Options FollowSymlinks
56 Require all granted
57
58 <FilesMatch "\.php$">
59 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
60 </FilesMatch>
61 </Directory>
62 <DirectoryMatch "${root}/data">
63 Require all denied
64 </DirectoryMatch>
65 '';
66 };
67 phpFpm = rec {
68 basedir = builtins.concatStringsSep ":" [ webRoot varDir config ];
69 socket = "/var/run/phpfpm/kanboard.sock";
70 pool = ''
71 listen = ${socket}
72 user = ${apache.user}
73 group = ${apache.group}
74 listen.owner = ${apache.user}
75 listen.group = ${apache.group}
76 pm = ondemand
77 pm.max_children = 60
78 pm.process_idle_timeout = 60
79
80 ; Needed to avoid clashes in browser cookies (same domain)
81 php_value[session.name] = KanboardPHPSESSID
82 php_admin_value[open_basedir] = "${basedir}:/tmp"
83 php_admin_value[session.save_path] = "${varDir}/phpSessions"
84 '';
85 };
86}