]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move adminer to pkgs
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 6 May 2019 22:41:04 +0000 (00:41 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 6 May 2019 22:41:04 +0000 (00:41 +0200)
nixops/modules/websites/commons/adminer.nix
pkgs/webapps/adminer/default.nix [new file with mode: 0644]
pkgs/webapps/default.nix

index ab789b3919046d9c60c5d9238ea32102115247e9..e91134797acf8a4bb7897daf0523dacb04c46687 100644 (file)
@@ -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}
-        <Directory ${root}>
-          DirectoryIndex index.php
-          Require all granted
-          <FilesMatch "\.php$">
-            SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
-          </FilesMatch>
-        </Directory>
-        '';
-    };
-    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}
+      <Directory ${root}>
+        DirectoryIndex index.php
+        Require all granted
+        <FilesMatch "\.php$">
+          SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
+        </FilesMatch>
+      </Directory>
+      '';
+  };
+}
diff --git a/pkgs/webapps/adminer/default.nix b/pkgs/webapps/adminer/default.nix
new file mode 100644 (file)
index 0000000..b78a2e0
--- /dev/null
@@ -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
+  '';
+}
index 4403f5da3eb969ff711c55c8edd22f46493a42cc..3b9cadfae475db6834f757d640daef0a4b4b4475 100644 (file)
@@ -42,4 +42,6 @@ rec {
   in
     lib.attrsets.genAttrs names
       (name: callPackage (./dokuwiki/plugins + "/${name}.nix") {});
+
+  adminer = callPackage ./adminer {};
 }