]>
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 | }; | |
10889174 IB |
27 | |
28 | cfg = config.services.myWebsites.tools.tools; | |
29 | in { | |
30 | options.services.myWebsites.tools.tools = { | |
31 | enable = lib.mkEnableOption "enable tools website"; | |
32 | }; | |
33 | ||
34 | config = lib.mkIf cfg.enable { | |
35 | security.acme.certs."eldiron".extraDomains."tools.immae.eu" = null; | |
36 | ||
37 | services.myWebsites.tools.modules = | |
1922655a IB |
38 | [ "proxy_fcgi" ] |
39 | ++ adminer.apache.modules | |
10889174 IB |
40 | ++ ympd.apache.modules |
41 | ++ ttrss.apache.modules | |
aebd817b | 42 | ++ roundcubemail.apache.modules |
133ebaee | 43 | ++ wallabag.apache.modules |
bfe3c9c9 | 44 | ++ yourls.apache.modules |
95b20e17 | 45 | ++ rompr.apache.modules |
b892dcbe IB |
46 | ++ shaarli.apache.modules |
47 | ++ dokuwiki.apache.modules; | |
10889174 | 48 | |
bfe3c9c9 | 49 | services.ympd = ympd.config // { enable = true; }; |
10889174 IB |
50 | |
51 | services.myWebsites.tools.vhostConfs.tools = { | |
52 | certName = "eldiron"; | |
53 | hosts = ["tools.immae.eu" ]; | |
1922655a | 54 | root = "/var/lib/ftp/tools.immae.eu"; |
10889174 | 55 | extraConfig = [ |
1922655a IB |
56 | '' |
57 | <Directory "/var/lib/ftp/tools.immae.eu"> | |
58 | AllowOverride all | |
59 | Require all granted | |
60 | <FilesMatch "\.php$"> | |
61 | SetHandler "proxy:unix:/var/run/phpfpm/tools.sock|fcgi://localhost" | |
62 | </FilesMatch> | |
63 | </Directory> | |
64 | '' | |
10889174 IB |
65 | adminer.apache.vhostConf |
66 | ympd.apache.vhostConf | |
67 | ttrss.apache.vhostConf | |
68 | roundcubemail.apache.vhostConf | |
aebd817b | 69 | wallabag.apache.vhostConf |
133ebaee | 70 | yourls.apache.vhostConf |
bfe3c9c9 | 71 | rompr.apache.vhostConf |
95b20e17 | 72 | shaarli.apache.vhostConf |
b892dcbe | 73 | dokuwiki.apache.vhostConf |
10889174 IB |
74 | ]; |
75 | }; | |
76 | ||
77 | services.myPhpfpm.poolConfigs = { | |
78 | adminer = adminer.phpFpm.pool; | |
79 | ttrss = ttrss.phpFpm.pool; | |
80 | roundcubemail = roundcubemail.phpFpm.pool; | |
aebd817b | 81 | wallabag = wallabag.phpFpm.pool; |
133ebaee | 82 | yourls = yourls.phpFpm.pool; |
bfe3c9c9 | 83 | rompr = rompr.phpFpm.pool; |
95b20e17 | 84 | shaarli = shaarli.phpFpm.pool; |
b892dcbe | 85 | dokuwiki = dokuwiki.phpFpm.pool; |
1922655a IB |
86 | tools = '' |
87 | listen = /var/run/phpfpm/tools.sock | |
88 | user = wwwrun | |
89 | group = wwwrun | |
90 | listen.owner = wwwrun | |
91 | listen.group = wwwrun | |
92 | pm = dynamic | |
93 | pm.max_children = 60 | |
94 | pm.start_servers = 2 | |
95 | pm.min_spare_servers = 1 | |
96 | pm.max_spare_servers = 10 | |
97 | ||
98 | ; Needed to avoid clashes in browser cookies (same domain) | |
99 | php_value[session.name] = ToolsPHPSESSID | |
100 | php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:/var/lib/ftp/tools.immae.eu:/tmp" | |
101 | ''; | |
10889174 IB |
102 | }; |
103 | ||
104 | system.activationScripts = { | |
105 | ttrss = ttrss.activationScript; | |
106 | roundcubemail = roundcubemail.activationScript; | |
aebd817b | 107 | wallabag = wallabag.activationScript; |
133ebaee | 108 | yourls = yourls.activationScript; |
bfe3c9c9 | 109 | rompr = rompr.activationScript; |
95b20e17 | 110 | shaarli = shaarli.activationScript; |
b892dcbe | 111 | dokuwiki = dokuwiki.activationScript; |
10889174 IB |
112 | }; |
113 | ||
114 | systemd.services.tt-rss = { | |
115 | description = "Tiny Tiny RSS feeds update daemon"; | |
116 | serviceConfig = { | |
117 | User = "wwwrun"; | |
118 | ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon"; | |
119 | StandardOutput = "syslog"; | |
120 | StandardError = "syslog"; | |
121 | PermissionsStartOnly = true; | |
122 | }; | |
123 | ||
124 | wantedBy = [ "multi-user.target" ]; | |
125 | requires = ["postgresql.service"]; | |
126 | after = ["network.target" "postgresql.service"]; | |
127 | }; | |
128 | ||
129 | }; | |
130 | } | |
131 |