]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - virtual/packages/adminer.nix
Move packages to specific files
[perso/Immae/Config/Nix.git] / virtual / packages / adminer.nix
CommitLineData
940f1834
IB
1with import ../../libs.nix;
2with nixpkgs_unstable;
3let
4 adminer = rec {
5 webRoot = pkgs.stdenv.mkDerivation rec {
6 version = "4.7.0";
7 name = "adminer-${version}";
8 src = pkgs.fetchurl {
9 url = "https://www.adminer.org/static/download/${version}/${name}.php";
10 sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7";
11 };
12 phases = "installPhase";
13 installPhase = ''
14 mkdir -p $out
15 cp $src $out/index.php
16 '';
17 };
18 phpFpm = rec {
19 socket = "/var/run/phpfpm/adminer.sock";
20 pool = ''
21 listen = ${socket}
22 user = ${apache.user}
23 group = ${apache.group}
24 listen.owner = ${apache.user}
25 listen.group = ${apache.group}
26 pm = ondemand
27 pm.max_children = 5
28 pm.process_idle_timeout = 60
29 ;php_admin_flag[log_errors] = on
30 php_admin_value[open_basedir] = "${webRoot}:/tmp"
31 '';
32 };
33 apache = {
34 user = "wwwrun";
35 group = "wwwrun";
36 modules = [ "proxy_fcgi" ];
37 vhostConf = ''
38 Alias /adminer ${webRoot}
39 <Directory ${webRoot}>
40 DirectoryIndex = index.php
41 <FilesMatch "\.php$">
42 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
43 </FilesMatch>
44 </Directory>
45 '';
46 };
47 nginxConf = {
48 alias = webRoot;
49 index = "index.php";
50 extraConfig = ''
51 include ${pkgs.nginx}/conf/fastcgi.conf;
52 fastcgi_split_path_info ^(.+?\.php)(/.*)$;
53 fastcgi_param HTTP_PROXY "";
54 fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php;
55 fastcgi_pass unix:${phpFpm.socket};
56 fastcgi_index index.php;
57 fastcgi_intercept_errors on;
58 '';
59 };
60 };
61in
62 adminer