From: Ismaƫl Bouya Date: Mon, 6 May 2019 22:41:04 +0000 (+0200) Subject: Move adminer to pkgs X-Git-Tag: nur_publish~61 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=7da817e32f5e285f5fe09726f6031d8c6d4c74ea;p=perso%2FImmae%2FConfig%2FNix.git Move adminer to pkgs --- 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 @@ -{ stdenv, fetchurl, nginx }: -let - adminer = rec { - webRoot = stdenv.mkDerivation rec { - version = "4.7.0"; - name = "adminer-${version}"; - src = fetchurl { - url = "https://www.adminer.org/static/download/${version}/${name}.php"; - sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; - }; - phases = "installPhase"; - installPhase = '' - mkdir -p $out - cp $src $out/index.php +{ stdenv, fetchurl, webapps }: +rec { + webRoot = webapps.adminer; + phpFpm = rec { + socket = "/var/run/phpfpm/adminer.sock"; + pool = '' + listen = ${socket} + user = ${apache.user} + group = ${apache.group} + listen.owner = ${apache.user} + listen.group = ${apache.group} + pm = ondemand + pm.max_children = 5 + pm.process_idle_timeout = 60 + ;php_admin_flag[log_errors] = on + ; Needed to avoid clashes in browser cookies (same domain) + php_value[session.name] = AdminerPHPSESSID + php_admin_value[open_basedir] = "${webRoot}:/tmp:/var/lib/php/sessions/adminer:/var/lib/php/tmp/adminer" + php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer" + php_admin_value[upload_tmp_dir] = "/var/lib/php/tmp/adminer" ''; - }; - phpFpm = rec { - socket = "/var/run/phpfpm/adminer.sock"; - pool = '' - listen = ${socket} - user = ${apache.user} - group = ${apache.group} - listen.owner = ${apache.user} - listen.group = ${apache.group} - pm = ondemand - pm.max_children = 5 - pm.process_idle_timeout = 60 - ;php_admin_flag[log_errors] = on - ; Needed to avoid clashes in browser cookies (same domain) - php_value[session.name] = AdminerPHPSESSID - php_admin_value[open_basedir] = "${webRoot}:/tmp:/var/lib/php/sessions/adminer:/var/lib/php/tmp/adminer" - php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer" - php_admin_value[upload_tmp_dir] = "/var/lib/php/tmp/adminer" - ''; - }; - apache = rec { - user = "wwwrun"; - group = "wwwrun"; - modules = [ "proxy_fcgi" ]; - webappName = "_adminer"; - root = "/run/current-system/webapps/${webappName}"; - vhostConf = '' - Alias /adminer ${root} - - DirectoryIndex index.php - Require all granted - - SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" - - - ''; - }; - nginxConf = { - alias = webRoot; - index = "index.php"; - extraConfig = '' - include ${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 - adminer + apache = rec { + user = "wwwrun"; + group = "wwwrun"; + modules = [ "proxy_fcgi" ]; + webappName = "_adminer"; + root = "/run/current-system/webapps/${webappName}"; + vhostConf = '' + Alias /adminer ${root} + + DirectoryIndex index.php + Require all granted + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + ''; + }; +} 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 @@ +{ stdenv, fetchurl }: +stdenv.mkDerivation rec { + version = "4.7.1"; + name = "adminer-${version}"; + src = fetchurl { + url = "https://www.adminer.org/static/download/${version}/${name}.php"; + sha256 = "00gnck9vd44wc6ihf7hh4ma6jvdsw69xgjlkbrdf6irnni6rnvhn"; + }; + phases = "installPhase"; + installPhase = '' + mkdir -p $out + cp $src $out/index.php + ''; +} 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 { in lib.attrsets.genAttrs names (name: callPackage (./dokuwiki/plugins + "/${name}.nix") {}); + + adminer = callPackage ./adminer {}; }