From 940f18341ee8f1e86a18a3488c41b5bbef909cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 1 Jan 2019 19:18:08 +0100 Subject: Move packages to specific files --- virtual/packages/adminer.nix | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 virtual/packages/adminer.nix (limited to 'virtual/packages/adminer.nix') diff --git a/virtual/packages/adminer.nix b/virtual/packages/adminer.nix new file mode 100644 index 0000000..35fa791 --- /dev/null +++ b/virtual/packages/adminer.nix @@ -0,0 +1,62 @@ +with import ../../libs.nix; +with nixpkgs_unstable; +let + adminer = rec { + webRoot = pkgs.stdenv.mkDerivation rec { + version = "4.7.0"; + name = "adminer-${version}"; + src = pkgs.fetchurl { + url = "https://www.adminer.org/static/download/${version}/${name}.php"; + sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; + }; + phases = "installPhase"; + installPhase = '' + mkdir -p $out + cp $src $out/index.php + ''; + }; + 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 + php_admin_value[open_basedir] = "${webRoot}:/tmp" + ''; + }; + apache = { + user = "wwwrun"; + group = "wwwrun"; + modules = [ "proxy_fcgi" ]; + vhostConf = '' + Alias /adminer ${webRoot} + + DirectoryIndex = index.php + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + ''; + }; + nginxConf = { + alias = webRoot; + index = "index.php"; + extraConfig = '' + include ${pkgs.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 -- cgit v1.2.3