]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, myconfig, mylibs, ... }: | |
2 | let | |
3 | adminer = pkgs.callPackage ../../commons/adminer.nix {}; | |
4 | ympd = pkgs.callPackage ./ympd.nix { | |
5 | env = myconfig.env.tools.ympd; | |
6 | }; | |
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; }; | |
13 | yourls = pkgs.callPackage ./yourls.nix { | |
14 | inherit (mylibs) fetchedGithub; | |
15 | env = myconfig.env.tools.yourls; | |
16 | }; | |
17 | rompr = pkgs.callPackage ./rompr.nix { | |
18 | inherit (mylibs) fetchedGithub; | |
19 | env = myconfig.env.tools.rompr; | |
20 | }; | |
21 | shaarli = pkgs.callPackage ./shaarli.nix { | |
22 | env = myconfig.env.tools.shaarli; | |
23 | }; | |
24 | dokuwiki = pkgs.callPackage ./dokuwiki.nix { | |
25 | inherit (mylibs) fetchedGithub; | |
26 | }; | |
27 | ldap = pkgs.callPackage ./ldap.nix { | |
28 | env = myconfig.env.tools.phpldapadmin; | |
29 | }; | |
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 = | |
41 | [ "proxy_fcgi" ] | |
42 | ++ adminer.apache.modules | |
43 | ++ ympd.apache.modules | |
44 | ++ ttrss.apache.modules | |
45 | ++ roundcubemail.apache.modules | |
46 | ++ wallabag.apache.modules | |
47 | ++ yourls.apache.modules | |
48 | ++ rompr.apache.modules | |
49 | ++ shaarli.apache.modules | |
50 | ++ dokuwiki.apache.modules | |
51 | ++ ldap.apache.modules; | |
52 | ||
53 | services.ympd = ympd.config // { enable = true; }; | |
54 | ||
55 | services.myWebsites.tools.vhostConfs.tools = { | |
56 | certName = "eldiron"; | |
57 | hosts = ["tools.immae.eu" ]; | |
58 | root = "/var/lib/ftp/tools.immae.eu"; | |
59 | extraConfig = [ | |
60 | '' | |
61 | <Directory "/var/lib/ftp/tools.immae.eu"> | |
62 | AllowOverride all | |
63 | Require all granted | |
64 | <FilesMatch "\.php$"> | |
65 | SetHandler "proxy:unix:/var/run/phpfpm/tools.sock|fcgi://localhost" | |
66 | </FilesMatch> | |
67 | </Directory> | |
68 | '' | |
69 | adminer.apache.vhostConf | |
70 | ympd.apache.vhostConf | |
71 | ttrss.apache.vhostConf | |
72 | roundcubemail.apache.vhostConf | |
73 | wallabag.apache.vhostConf | |
74 | yourls.apache.vhostConf | |
75 | rompr.apache.vhostConf | |
76 | shaarli.apache.vhostConf | |
77 | dokuwiki.apache.vhostConf | |
78 | ldap.apache.vhostConf | |
79 | ]; | |
80 | }; | |
81 | ||
82 | services.myPhpfpm.poolConfigs = { | |
83 | adminer = adminer.phpFpm.pool; | |
84 | ttrss = ttrss.phpFpm.pool; | |
85 | roundcubemail = roundcubemail.phpFpm.pool; | |
86 | wallabag = wallabag.phpFpm.pool; | |
87 | yourls = yourls.phpFpm.pool; | |
88 | rompr = rompr.phpFpm.pool; | |
89 | shaarli = shaarli.phpFpm.pool; | |
90 | dokuwiki = dokuwiki.phpFpm.pool; | |
91 | ldap = ldap.phpFpm.pool; | |
92 | tools = '' | |
93 | listen = /var/run/phpfpm/tools.sock | |
94 | user = wwwrun | |
95 | group = wwwrun | |
96 | listen.owner = wwwrun | |
97 | listen.group = wwwrun | |
98 | pm = dynamic | |
99 | pm.max_children = 60 | |
100 | pm.start_servers = 2 | |
101 | pm.min_spare_servers = 1 | |
102 | pm.max_spare_servers = 10 | |
103 | ||
104 | ; Needed to avoid clashes in browser cookies (same domain) | |
105 | php_value[session.name] = ToolsPHPSESSID | |
106 | php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:/var/lib/ftp/tools.immae.eu:/tmp" | |
107 | ''; | |
108 | }; | |
109 | ||
110 | system.activationScripts = { | |
111 | ttrss = ttrss.activationScript; | |
112 | roundcubemail = roundcubemail.activationScript; | |
113 | wallabag = wallabag.activationScript; | |
114 | yourls = yourls.activationScript; | |
115 | rompr = rompr.activationScript; | |
116 | shaarli = shaarli.activationScript; | |
117 | dokuwiki = dokuwiki.activationScript; | |
118 | }; | |
119 | ||
120 | systemd.services.tt-rss = { | |
121 | description = "Tiny Tiny RSS feeds update daemon"; | |
122 | serviceConfig = { | |
123 | User = "wwwrun"; | |
124 | ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon"; | |
125 | StandardOutput = "syslog"; | |
126 | StandardError = "syslog"; | |
127 | PermissionsStartOnly = true; | |
128 | }; | |
129 | ||
130 | wantedBy = [ "multi-user.target" ]; | |
131 | requires = ["postgresql.service"]; | |
132 | after = ["network.target" "postgresql.service"]; | |
133 | }; | |
134 | ||
135 | }; | |
136 | } | |
137 |