]>
Commit | Line | Data |
---|---|---|
ab5d04b8 IB |
1 | with import (builtins.fetchTarball { |
2 | # FIXME: upgrade to nixpkgs 19 when stable and stick to stable | |
3 | # versions | |
4 | name = "nixos-unstable-2018-12-08"; | |
5 | url = https://github.com/nixos/nixpkgs/archive/61c3169a0e17d789c566d5b241bfe309ce4a6275.tar.gz; | |
6 | sha256 = "0qbycg7wkb71v20rchlkafrjfpbk2fnlvvbh3ai9pyfisci5wxvq"; | |
7 | }) {}; | |
8 | let | |
27e22b76 IB |
9 | adminer = rec { |
10 | webRoot = pkgs.stdenv.mkDerivation rec { | |
1bb2ff2c IB |
11 | version = "4.7.0"; |
12 | name = "adminer-${version}"; | |
27e22b76 | 13 | src = pkgs.fetchurl { |
1bb2ff2c | 14 | url = "https://www.adminer.org/static/download/${version}/${name}.php"; |
27e22b76 IB |
15 | sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; |
16 | }; | |
17 | phases = "installPhase"; | |
18 | installPhase = '' | |
19 | mkdir -p $out | |
20 | cp $src $out/index.php | |
21 | ''; | |
22 | }; | |
23 | phpFpm = rec { | |
24 | socket = "/var/run/phpfpm/adminer.sock"; | |
25 | pool = '' | |
26 | listen = ${socket} | |
1bb2ff2c IB |
27 | user = ${apache.user} |
28 | group = ${apache.group} | |
29 | listen.owner = ${apache.user} | |
30 | listen.group = ${apache.group} | |
27e22b76 IB |
31 | pm = ondemand |
32 | pm.max_children = 5 | |
33 | pm.process_idle_timeout = 60 | |
34 | ;php_admin_flag[log_errors] = on | |
35 | php_admin_value[open_basedir] = "${webRoot}:/tmp" | |
36 | ''; | |
37 | }; | |
1bb2ff2c IB |
38 | apache = { |
39 | user = "wwwrun"; | |
40 | group = "wwwrun"; | |
41 | vhostConf = '' | |
42 | Alias /adminer ${webRoot} | |
43 | <Directory ${webRoot}> | |
44 | DirectoryIndex = index.php | |
45 | <FilesMatch "\.php$"> | |
46 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | |
47 | </FilesMatch> | |
48 | </Directory> | |
49 | ''; | |
50 | }; | |
27e22b76 IB |
51 | nginxConf = { |
52 | alias = webRoot; | |
53 | index = "index.php"; | |
54 | extraConfig = '' | |
55 | include ${pkgs.nginx}/conf/fastcgi.conf; | |
56 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; | |
57 | fastcgi_param HTTP_PROXY ""; | |
58 | fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php; | |
59 | fastcgi_pass unix:${phpFpm.socket}; | |
60 | fastcgi_index index.php; | |
61 | fastcgi_intercept_errors on; | |
62 | ''; | |
63 | }; | |
ab5d04b8 | 64 | }; |
a05f8abe IB |
65 | |
66 | ympd = rec { | |
67 | config = { | |
68 | webPort = "localhost:18001"; | |
69 | mpd = { | |
70 | host = "malige.home.immae.eu"; | |
71 | port = 6600; | |
72 | }; | |
73 | }; | |
74 | apache = { | |
75 | vhostConf = '' | |
76 | <LocationMatch "^/mpd"> | |
77 | Use LDAPConnect | |
78 | Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu | |
79 | Require local | |
80 | </LocationMatch> | |
81 | ||
82 | RedirectMatch permanent "^/mpd$" "/mpd/" | |
83 | <Location "/mpd/"> | |
84 | ProxyPass http://${config.webPort}/ | |
85 | ProxyPassReverse http://${config.webPort}/ | |
86 | ProxyPreserveHost on | |
87 | </Location> | |
88 | <Location "/mpd/ws"> | |
89 | ProxyPass ws://${config.webPort}/ws | |
90 | </Location> | |
91 | ''; | |
92 | }; | |
93 | }; | |
ab5d04b8 IB |
94 | in |
95 | { | |
96 | inherit adminer; | |
a05f8abe | 97 | inherit ympd; |
ab5d04b8 | 98 | } |