diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-07 00:41:04 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-07 00:41:04 +0200 |
commit | 7da817e32f5e285f5fe09726f6031d8c6d4c74ea (patch) | |
tree | a14f400f40e4a69c1edd57384ba719ace06afe8f | |
parent | d21de7a044cc39c452306880707f79162b666b60 (diff) | |
download | Nix-7da817e32f5e285f5fe09726f6031d8c6d4c74ea.tar.gz Nix-7da817e32f5e285f5fe09726f6031d8c6d4c74ea.tar.zst Nix-7da817e32f5e285f5fe09726f6031d8c6d4c74ea.zip |
Move adminer to pkgs
-rw-r--r-- | nixops/modules/websites/commons/adminer.nix | 104 | ||||
-rw-r--r-- | pkgs/webapps/adminer/default.nix | 14 | ||||
-rw-r--r-- | pkgs/webapps/default.nix | 2 |
3 files changed, 54 insertions, 66 deletions
diff --git a/nixops/modules/websites/commons/adminer.nix b/nixops/modules/websites/commons/adminer.nix index ab789b3..e911347 100644 --- a/nixops/modules/websites/commons/adminer.nix +++ b/nixops/modules/websites/commons/adminer.nix | |||
@@ -1,68 +1,40 @@ | |||
1 | { stdenv, fetchurl, nginx }: | 1 | { stdenv, fetchurl, webapps }: |
2 | let | 2 | rec { |
3 | adminer = rec { | 3 | webRoot = webapps.adminer; |
4 | webRoot = stdenv.mkDerivation rec { | 4 | phpFpm = rec { |
5 | version = "4.7.0"; | 5 | socket = "/var/run/phpfpm/adminer.sock"; |
6 | name = "adminer-${version}"; | 6 | pool = '' |
7 | src = fetchurl { | 7 | listen = ${socket} |
8 | url = "https://www.adminer.org/static/download/${version}/${name}.php"; | 8 | user = ${apache.user} |
9 | sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; | 9 | group = ${apache.group} |
10 | }; | 10 | listen.owner = ${apache.user} |
11 | phases = "installPhase"; | 11 | listen.group = ${apache.group} |
12 | installPhase = '' | 12 | pm = ondemand |
13 | mkdir -p $out | 13 | pm.max_children = 5 |
14 | cp $src $out/index.php | 14 | pm.process_idle_timeout = 60 |
15 | ;php_admin_flag[log_errors] = on | ||
16 | ; Needed to avoid clashes in browser cookies (same domain) | ||
17 | php_value[session.name] = AdminerPHPSESSID | ||
18 | php_admin_value[open_basedir] = "${webRoot}:/tmp:/var/lib/php/sessions/adminer:/var/lib/php/tmp/adminer" | ||
19 | php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer" | ||
20 | php_admin_value[upload_tmp_dir] = "/var/lib/php/tmp/adminer" | ||
15 | ''; | 21 | ''; |
16 | }; | ||
17 | phpFpm = rec { | ||
18 | socket = "/var/run/phpfpm/adminer.sock"; | ||
19 | pool = '' | ||
20 | listen = ${socket} | ||
21 | user = ${apache.user} | ||
22 | group = ${apache.group} | ||
23 | listen.owner = ${apache.user} | ||
24 | listen.group = ${apache.group} | ||
25 | pm = ondemand | ||
26 | pm.max_children = 5 | ||
27 | pm.process_idle_timeout = 60 | ||
28 | ;php_admin_flag[log_errors] = on | ||
29 | ; Needed to avoid clashes in browser cookies (same domain) | ||
30 | php_value[session.name] = AdminerPHPSESSID | ||
31 | php_admin_value[open_basedir] = "${webRoot}:/tmp:/var/lib/php/sessions/adminer:/var/lib/php/tmp/adminer" | ||
32 | php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer" | ||
33 | php_admin_value[upload_tmp_dir] = "/var/lib/php/tmp/adminer" | ||
34 | ''; | ||
35 | }; | ||
36 | apache = rec { | ||
37 | user = "wwwrun"; | ||
38 | group = "wwwrun"; | ||
39 | modules = [ "proxy_fcgi" ]; | ||
40 | webappName = "_adminer"; | ||
41 | root = "/run/current-system/webapps/${webappName}"; | ||
42 | vhostConf = '' | ||
43 | Alias /adminer ${root} | ||
44 | <Directory ${root}> | ||
45 | DirectoryIndex index.php | ||
46 | Require all granted | ||
47 | <FilesMatch "\.php$"> | ||
48 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
49 | </FilesMatch> | ||
50 | </Directory> | ||
51 | ''; | ||
52 | }; | ||
53 | nginxConf = { | ||
54 | alias = webRoot; | ||
55 | index = "index.php"; | ||
56 | extraConfig = '' | ||
57 | include ${nginx}/conf/fastcgi.conf; | ||
58 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; | ||
59 | fastcgi_param HTTP_PROXY ""; | ||
60 | fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php; | ||
61 | fastcgi_pass unix:${phpFpm.socket}; | ||
62 | fastcgi_index index.php; | ||
63 | fastcgi_intercept_errors on; | ||
64 | ''; | ||
65 | }; | ||
66 | }; | 22 | }; |
67 | in | 23 | apache = rec { |
68 | adminer | 24 | user = "wwwrun"; |
25 | group = "wwwrun"; | ||
26 | modules = [ "proxy_fcgi" ]; | ||
27 | webappName = "_adminer"; | ||
28 | root = "/run/current-system/webapps/${webappName}"; | ||
29 | vhostConf = '' | ||
30 | Alias /adminer ${root} | ||
31 | <Directory ${root}> | ||
32 | DirectoryIndex index.php | ||
33 | Require all granted | ||
34 | <FilesMatch "\.php$"> | ||
35 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
36 | </FilesMatch> | ||
37 | </Directory> | ||
38 | ''; | ||
39 | }; | ||
40 | } | ||
diff --git a/pkgs/webapps/adminer/default.nix b/pkgs/webapps/adminer/default.nix new file mode 100644 index 0000000..b78a2e0 --- /dev/null +++ b/pkgs/webapps/adminer/default.nix | |||
@@ -0,0 +1,14 @@ | |||
1 | { stdenv, fetchurl }: | ||
2 | stdenv.mkDerivation rec { | ||
3 | version = "4.7.1"; | ||
4 | name = "adminer-${version}"; | ||
5 | src = fetchurl { | ||
6 | url = "https://www.adminer.org/static/download/${version}/${name}.php"; | ||
7 | sha256 = "00gnck9vd44wc6ihf7hh4ma6jvdsw69xgjlkbrdf6irnni6rnvhn"; | ||
8 | }; | ||
9 | phases = "installPhase"; | ||
10 | installPhase = '' | ||
11 | mkdir -p $out | ||
12 | cp $src $out/index.php | ||
13 | ''; | ||
14 | } | ||
diff --git a/pkgs/webapps/default.nix b/pkgs/webapps/default.nix index 4403f5d..3b9cadf 100644 --- a/pkgs/webapps/default.nix +++ b/pkgs/webapps/default.nix | |||
@@ -42,4 +42,6 @@ rec { | |||
42 | in | 42 | in |
43 | lib.attrsets.genAttrs names | 43 | lib.attrsets.genAttrs names |
44 | (name: callPackage (./dokuwiki/plugins + "/${name}.nix") {}); | 44 | (name: callPackage (./dokuwiki/plugins + "/${name}.nix") {}); |
45 | |||
46 | adminer = callPackage ./adminer {}; | ||
45 | } | 47 | } |