]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/tools/tools/default.nix
Add peertube tool
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / tools / default.nix
CommitLineData
9d90e7e2 1{ lib, pkgs, config, myconfig, mylibs, ... }:
10889174
IB
2let
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;
32in {
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
e229e6f2
IB
121 nixpkgs.config.packageOverrides = oldpkgs: rec {
122 ympd = oldpkgs.ympd.overrideAttrs(old: mylibs.fetchedGithub ./ympd.json);
123 };
124
10889174
IB
125 systemd.services.tt-rss = {
126 description = "Tiny Tiny RSS feeds update daemon";
127 serviceConfig = {
128 User = "wwwrun";
129 ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon";
130 StandardOutput = "syslog";
131 StandardError = "syslog";
132 PermissionsStartOnly = true;
133 };
134
135 wantedBy = [ "multi-user.target" ];
136 requires = ["postgresql.service"];
137 after = ["network.target" "postgresql.service"];
138 };
139
140 };
141}
142