aboutsummaryrefslogtreecommitdiff
path: root/virtual/packages.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-28 17:52:40 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-28 17:52:40 +0100
commit27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4 (patch)
tree9ffa9c637b4fd94156c5cc32089fb16df86a132a /virtual/packages.nix
parentcbc248ed9c13781b3beca56c902531b3ae056041 (diff)
downloadNix-27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4.tar.gz
Nix-27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4.tar.zst
Nix-27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4.zip
Put adminer configuration in its package
Diffstat (limited to 'virtual/packages.nix')
-rw-r--r--virtual/packages.nix62
1 files changed, 50 insertions, 12 deletions
diff --git a/virtual/packages.nix b/virtual/packages.nix
index 6c552f6..2e16a0d 100644
--- a/virtual/packages.nix
+++ b/virtual/packages.nix
@@ -6,19 +6,57 @@ with import (builtins.fetchTarball {
6 sha256 = "0qbycg7wkb71v20rchlkafrjfpbk2fnlvvbh3ai9pyfisci5wxvq"; 6 sha256 = "0qbycg7wkb71v20rchlkafrjfpbk2fnlvvbh3ai9pyfisci5wxvq";
7}) {}; 7}) {};
8let 8let
9adminer = pkgs.stdenv.mkDerivation rec { 9 adminer = rec {
10 name = "adminer-4.7.0"; 10 webRoot = pkgs.stdenv.mkDerivation rec {
11 src = pkgs.fetchurl { 11 name = "adminer-4.7.0";
12 url = "https://www.adminer.org/static/download/4.7.0/${name}.php"; 12 src = pkgs.fetchurl {
13 sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; 13 url = "https://www.adminer.org/static/download/4.7.0/${name}.php";
14 sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7";
15 };
16 phases = "installPhase";
17 installPhase = ''
18 mkdir -p $out
19 cp $src $out/index.php
20 '';
21 };
22 phpFpm = rec {
23 socket = "/var/run/phpfpm/adminer.sock";
24 pool = ''
25 listen = ${socket}
26 user = wwwrun
27 group = wwwrun
28 listen.owner = wwwrun
29 listen.group = wwwrun
30 pm = ondemand
31 pm.max_children = 5
32 pm.process_idle_timeout = 60
33 ;php_admin_flag[log_errors] = on
34 php_admin_value[open_basedir] = "${webRoot}:/tmp"
35 '';
36 };
37 apacheConf = ''
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 nginxConf = {
47 alias = webRoot;
48 index = "index.php";
49 extraConfig = ''
50 include ${pkgs.nginx}/conf/fastcgi.conf;
51 fastcgi_split_path_info ^(.+?\.php)(/.*)$;
52 fastcgi_param HTTP_PROXY "";
53 fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php;
54 fastcgi_pass unix:${phpFpm.socket};
55 fastcgi_index index.php;
56 fastcgi_intercept_errors on;
57 '';
58 };
14 }; 59 };
15 phases = "installPhase";
16 installPhase = ''
17 mkdir -p $out
18 cp $src $out/index.php
19 '';
20};
21
22in 60in
23 { 61 {
24 inherit adminer; 62 inherit adminer;