]>
Commit | Line | Data |
---|---|---|
9d90e7e2 | 1 | { lib, pkgs, config, myconfig, mylibs, ... }: |
10889174 IB |
2 | let |
3 | adminer = pkgs.callPackage ../../commons/adminer.nix {}; | |
bfe3c9c9 IB |
4 | ympd = pkgs.callPackage ./ympd.nix { |
5 | env = myconfig.env.tools.ympd; | |
6 | }; | |
9d90e7e2 IB |
7 | ttrss = pkgs.callPackage ./ttrss.nix { |
8 | inherit (mylibs) fetchedGithub fetchedGit; | |
9 | env = myconfig.env.tools.ttrss; | |
10 | }; | |
11 | roundcubemail = pkgs.callPackage ./roundcubemail.nix { env = myconfig.env.tools.roundcubemail; }; | |
12 | wallabag = pkgs.callPackage ./wallabag.nix { env = myconfig.env.tools.wallabag; }; | |
133ebaee IB |
13 | yourls = pkgs.callPackage ./yourls.nix { |
14 | inherit (mylibs) fetchedGithub; | |
15 | env = myconfig.env.tools.yourls; | |
16 | }; | |
bfe3c9c9 IB |
17 | rompr = pkgs.callPackage ./rompr.nix { |
18 | inherit (mylibs) fetchedGithub; | |
19 | env = myconfig.env.tools.rompr; | |
20 | }; | |
95b20e17 IB |
21 | shaarli = pkgs.callPackage ./shaarli.nix { |
22 | env = myconfig.env.tools.shaarli; | |
23 | }; | |
b892dcbe IB |
24 | dokuwiki = pkgs.callPackage ./dokuwiki.nix { |
25 | inherit (mylibs) fetchedGithub; | |
26 | }; | |
f80772dc IB |
27 | ldap = pkgs.callPackage ./ldap.nix { |
28 | env = myconfig.env.tools.phpldapadmin; | |
29 | }; | |
10889174 IB |
30 | |
31 | cfg = config.services.myWebsites.tools.tools; | |
32 | in { | |
33 | options.services.myWebsites.tools.tools = { | |
34 | enable = lib.mkEnableOption "enable tools website"; | |
35 | }; | |
36 | ||
37 | config = lib.mkIf cfg.enable { | |
38 | security.acme.certs."eldiron".extraDomains."tools.immae.eu" = null; | |
39 | ||
40 | services.myWebsites.tools.modules = | |
1922655a IB |
41 | [ "proxy_fcgi" ] |
42 | ++ adminer.apache.modules | |
10889174 IB |
43 | ++ ympd.apache.modules |
44 | ++ ttrss.apache.modules | |
aebd817b | 45 | ++ roundcubemail.apache.modules |
133ebaee | 46 | ++ wallabag.apache.modules |
bfe3c9c9 | 47 | ++ yourls.apache.modules |
95b20e17 | 48 | ++ rompr.apache.modules |
b892dcbe | 49 | ++ shaarli.apache.modules |
f80772dc IB |
50 | ++ dokuwiki.apache.modules |
51 | ++ ldap.apache.modules; | |
10889174 | 52 | |
bfe3c9c9 | 53 | services.ympd = ympd.config // { enable = true; }; |
10889174 IB |
54 | |
55 | services.myWebsites.tools.vhostConfs.tools = { | |
56 | certName = "eldiron"; | |
57 | hosts = ["tools.immae.eu" ]; | |
1922655a | 58 | root = "/var/lib/ftp/tools.immae.eu"; |
10889174 | 59 | extraConfig = [ |
1922655a IB |
60 | '' |
61 | <Directory "/var/lib/ftp/tools.immae.eu"> | |
0eaac6ba | 62 | DirectoryIndex index.php index.htm index.html |
1922655a IB |
63 | AllowOverride all |
64 | Require all granted | |
65 | <FilesMatch "\.php$"> | |
66 | SetHandler "proxy:unix:/var/run/phpfpm/tools.sock|fcgi://localhost" | |
67 | </FilesMatch> | |
68 | </Directory> | |
69 | '' | |
10889174 IB |
70 | adminer.apache.vhostConf |
71 | ympd.apache.vhostConf | |
72 | ttrss.apache.vhostConf | |
73 | roundcubemail.apache.vhostConf | |
aebd817b | 74 | wallabag.apache.vhostConf |
133ebaee | 75 | yourls.apache.vhostConf |
bfe3c9c9 | 76 | rompr.apache.vhostConf |
95b20e17 | 77 | shaarli.apache.vhostConf |
b892dcbe | 78 | dokuwiki.apache.vhostConf |
f80772dc | 79 | ldap.apache.vhostConf |
10889174 IB |
80 | ]; |
81 | }; | |
82 | ||
83 | services.myPhpfpm.poolConfigs = { | |
84 | adminer = adminer.phpFpm.pool; | |
85 | ttrss = ttrss.phpFpm.pool; | |
86 | roundcubemail = roundcubemail.phpFpm.pool; | |
aebd817b | 87 | wallabag = wallabag.phpFpm.pool; |
133ebaee | 88 | yourls = yourls.phpFpm.pool; |
bfe3c9c9 | 89 | rompr = rompr.phpFpm.pool; |
95b20e17 | 90 | shaarli = shaarli.phpFpm.pool; |
b892dcbe | 91 | dokuwiki = dokuwiki.phpFpm.pool; |
f80772dc | 92 | ldap = ldap.phpFpm.pool; |
1922655a IB |
93 | tools = '' |
94 | listen = /var/run/phpfpm/tools.sock | |
95 | user = wwwrun | |
96 | group = wwwrun | |
97 | listen.owner = wwwrun | |
98 | listen.group = wwwrun | |
99 | pm = dynamic | |
100 | pm.max_children = 60 | |
101 | pm.start_servers = 2 | |
102 | pm.min_spare_servers = 1 | |
103 | pm.max_spare_servers = 10 | |
104 | ||
105 | ; Needed to avoid clashes in browser cookies (same domain) | |
106 | php_value[session.name] = ToolsPHPSESSID | |
107 | php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:/var/lib/ftp/tools.immae.eu:/tmp" | |
108 | ''; | |
10889174 IB |
109 | }; |
110 | ||
111 | system.activationScripts = { | |
112 | ttrss = ttrss.activationScript; | |
113 | roundcubemail = roundcubemail.activationScript; | |
aebd817b | 114 | wallabag = wallabag.activationScript; |
133ebaee | 115 | yourls = yourls.activationScript; |
bfe3c9c9 | 116 | rompr = rompr.activationScript; |
95b20e17 | 117 | shaarli = shaarli.activationScript; |
b892dcbe | 118 | dokuwiki = dokuwiki.activationScript; |
10889174 IB |
119 | }; |
120 | ||
a95ab089 IB |
121 | system.extraSystemBuilderCmds = '' |
122 | mkdir -p $out/webapps | |
123 | ln -s ${dokuwiki.webRoot} $out/webapps/${dokuwiki.apache.webappName} | |
124 | ln -s ${ldap.webRoot}/htdocs $out/webapps/${ldap.apache.webappName} | |
125 | ln -s ${rompr.webRoot} $out/webapps/${rompr.apache.webappName} | |
126 | ln -s ${roundcubemail.webRoot} $out/webapps/${roundcubemail.apache.webappName} | |
127 | ln -s ${shaarli.webRoot} $out/webapps/${shaarli.apache.webappName} | |
128 | ln -s ${ttrss.webRoot} $out/webapps/${ttrss.apache.webappName} | |
129 | ln -s ${wallabag.webRoot} $out/webapps/${wallabag.apache.webappName} | |
130 | ln -s ${yourls.webRoot} $out/webapps/${yourls.apache.webappName} | |
131 | ''; | |
132 | ||
e229e6f2 IB |
133 | nixpkgs.config.packageOverrides = oldpkgs: rec { |
134 | ympd = oldpkgs.ympd.overrideAttrs(old: mylibs.fetchedGithub ./ympd.json); | |
135 | }; | |
136 | ||
10889174 IB |
137 | systemd.services.tt-rss = { |
138 | description = "Tiny Tiny RSS feeds update daemon"; | |
139 | serviceConfig = { | |
140 | User = "wwwrun"; | |
141 | ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon"; | |
142 | StandardOutput = "syslog"; | |
143 | StandardError = "syslog"; | |
144 | PermissionsStartOnly = true; | |
145 | }; | |
146 | ||
147 | wantedBy = [ "multi-user.target" ]; | |
148 | requires = ["postgresql.service"]; | |
149 | after = ["network.target" "postgresql.service"]; | |
150 | }; | |
151 | ||
152 | }; | |
153 | } | |
154 |