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