diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-12-28 17:52:40 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-12-28 17:52:40 +0100 |
commit | 27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4 (patch) | |
tree | 9ffa9c637b4fd94156c5cc32089fb16df86a132a /virtual | |
parent | cbc248ed9c13781b3beca56c902531b3ae056041 (diff) | |
download | Nix-27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4.tar.gz Nix-27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4.tar.zst Nix-27e22b76e2f7d402c1556d6bbf99cf5e1316f9d4.zip |
Put adminer configuration in its package
Diffstat (limited to 'virtual')
-rw-r--r-- | virtual/eldiron.nix | 27 | ||||
-rw-r--r-- | virtual/packages.nix | 62 |
2 files changed, 56 insertions, 33 deletions
diff --git a/virtual/eldiron.nix b/virtual/eldiron.nix index 38f753c..768de84 100644 --- a/virtual/eldiron.nix +++ b/virtual/eldiron.nix | |||
@@ -53,18 +53,7 @@ | |||
53 | log_level = notice | 53 | log_level = notice |
54 | ''; | 54 | ''; |
55 | poolConfigs = { | 55 | poolConfigs = { |
56 | adminer = '' | 56 | adminer = mypkgs.adminer.phpFpm.pool; |
57 | listen = /var/run/phpfpm/adminer.sock | ||
58 | user = wwwrun | ||
59 | group = wwwrun | ||
60 | listen.owner = wwwrun | ||
61 | listen.group = wwwrun | ||
62 | pm = ondemand | ||
63 | pm.max_children = 5 | ||
64 | pm.process_idle_timeout = 60 | ||
65 | ;php_admin_flag[log_errors] = on | ||
66 | php_admin_value[open_basedir] = "${mypkgs.adminer}:/tmp" | ||
67 | ''; | ||
68 | www = '' | 57 | www = '' |
69 | listen = /var/run/phpfpm/www.sock | 58 | listen = /var/run/phpfpm/www.sock |
70 | user = wwwrun | 59 | user = wwwrun |
@@ -106,15 +95,9 @@ | |||
106 | listen = [ { ip = "*"; port = 443; } ]; | 95 | listen = [ { ip = "*"; port = 443; } ]; |
107 | hostName = "db-1.immae.eu"; | 96 | hostName = "db-1.immae.eu"; |
108 | documentRoot = null; | 97 | documentRoot = null; |
109 | extraConfig = '' | 98 | extraConfig = builtins.concatStringsSep "\n" [ |
110 | Alias /adminer ${mypkgs.adminer} | 99 | mypkgs.adminer.apacheConf |
111 | <Directory ${mypkgs.adminer}> | 100 | ]; |
112 | DirectoryIndex = index.php | ||
113 | <FilesMatch "\.php$"> | ||
114 | SetHandler "proxy:unix:/var/run/phpfpm/adminer.sock|fcgi://localhost" | ||
115 | </FilesMatch> | ||
116 | </Directory> | ||
117 | ''; | ||
118 | }) | 101 | }) |
119 | { # Should go last, default fallback | 102 | { # Should go last, default fallback |
120 | listen = [ { ip = "*"; port = 80; } ]; | 103 | listen = [ { ip = "*"; port = 80; } ]; |
@@ -160,6 +143,7 @@ | |||
160 | # FIXME: backup | 143 | # FIXME: backup |
161 | # FIXME: restart after pam | 144 | # FIXME: restart after pam |
162 | # FIXME: pam access doesn’t work (because of php module) | 145 | # FIXME: pam access doesn’t work (because of php module) |
146 | # FIXME: ssl | ||
163 | services.mysql = rec { | 147 | services.mysql = rec { |
164 | enable = true; | 148 | enable = true; |
165 | package = pkgs.mariadb.overrideAttrs(old: rec { | 149 | package = pkgs.mariadb.overrideAttrs(old: rec { |
@@ -170,6 +154,7 @@ | |||
170 | 154 | ||
171 | # FIXME: initial sync | 155 | # FIXME: initial sync |
172 | # FIXME: backup | 156 | # FIXME: backup |
157 | # FIXME: ssl | ||
173 | services.postgresql = rec { | 158 | services.postgresql = rec { |
174 | enable = true; | 159 | enable = true; |
175 | package = pkgs.postgresql100.overrideAttrs(old: rec { | 160 | package = pkgs.postgresql100.overrideAttrs(old: rec { |
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 | }) {}; |
8 | let | 8 | let |
9 | adminer = 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 | |||
22 | in | 60 | in |
23 | { | 61 | { |
24 | inherit adminer; | 62 | inherit adminer; |