blob: 2e16a0da89a2963d6a50786338dab2fb6f77b87b (
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
|
with import (builtins.fetchTarball {
# FIXME: upgrade to nixpkgs 19 when stable and stick to stable
# versions
name = "nixos-unstable-2018-12-08";
url = https://github.com/nixos/nixpkgs/archive/61c3169a0e17d789c566d5b241bfe309ce4a6275.tar.gz;
sha256 = "0qbycg7wkb71v20rchlkafrjfpbk2fnlvvbh3ai9pyfisci5wxvq";
}) {};
let
adminer = rec {
webRoot = pkgs.stdenv.mkDerivation rec {
name = "adminer-4.7.0";
src = pkgs.fetchurl {
url = "https://www.adminer.org/static/download/4.7.0/${name}.php";
sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7";
};
phases = "installPhase";
installPhase = ''
mkdir -p $out
cp $src $out/index.php
'';
};
phpFpm = rec {
socket = "/var/run/phpfpm/adminer.sock";
pool = ''
listen = ${socket}
user = wwwrun
group = wwwrun
listen.owner = wwwrun
listen.group = wwwrun
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 60
;php_admin_flag[log_errors] = on
php_admin_value[open_basedir] = "${webRoot}:/tmp"
'';
};
apacheConf = ''
Alias /adminer ${webRoot}
<Directory ${webRoot}>
DirectoryIndex = index.php
<FilesMatch "\.php$">
SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
</FilesMatch>
</Directory>
'';
nginxConf = {
alias = webRoot;
index = "index.php";
extraConfig = ''
include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php;
fastcgi_pass unix:${phpFpm.socket};
fastcgi_index index.php;
fastcgi_intercept_errors on;
'';
};
};
in
{
inherit adminer;
}
|