]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move rompr to pkgs
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 5 May 2019 23:41:39 +0000 (01:41 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 5 May 2019 23:41:39 +0000 (01:41 +0200)
nixops/modules/websites/tools/tools/default.nix
nixops/modules/websites/tools/tools/rompr.nix
pkgs/webapps/default.nix
pkgs/webapps/rompr/default.nix [new file with mode: 0644]
pkgs/webapps/rompr/rompr.json [moved from nixops/modules/websites/tools/tools/rompr.json with 100% similarity]

index e8722242c5c7494bfc410ba917f49ea6a58a1353..95679f6850e10e1e95842bbb1c3c56466c1b43d1 100644 (file)
@@ -23,7 +23,7 @@ let
       env = myconfig.env.tools.yourls;
     };
     rompr = pkgs.callPackage ./rompr.nix {
-      inherit (mylibs) fetchedGithub;
+      inherit (pkgs.webapps) rompr;
       env = myconfig.env.tools.rompr;
     };
     shaarli = pkgs.callPackage ./shaarli.nix {
index ca93bead97777411d86b60df0d2e6c0260cee6f4..fea59fc9957ba664f98f02db6722292433fa3211 100644 (file)
@@ -1,87 +1,77 @@
-{ lib, env, stdenv, fetchedGithub }:
-let
-  rompr = let
-  in rec {
-    varDir = "/var/lib/rompr";
-    activationScript = ''
-      install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
-        ${varDir}/prefs ${varDir}/albumart ${varDir}/phpSessions
-    '';
-    webRoot = stdenv.mkDerivation (fetchedGithub ./rompr.json // rec {
-      installPhase = ''
-        cp -a . $out
-        ln -sf ${varDir}/prefs $out/prefs
-        ln -sf ${varDir}/albumart $out/albumart
-      '';
-    });
-    apache = rec {
-      user = "wwwrun";
-      group = "wwwrun";
-      modules = [ "headers" "mime" "proxy_fcgi" ];
-      webappName = "tools_rompr";
-      root = "/run/current-system/webapps/${webappName}";
-      vhostConf = ''
-        Alias /rompr ${root}
+{ lib, env, rompr }:
+rec {
+  varDir = "/var/lib/rompr";
+  activationScript = ''
+    install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
+      ${varDir}/prefs ${varDir}/albumart ${varDir}/phpSessions
+  '';
+  webRoot = rompr;
+  apache = rec {
+    user = "wwwrun";
+    group = "wwwrun";
+    modules = [ "headers" "mime" "proxy_fcgi" ];
+    webappName = "tools_rompr";
+    root = "/run/current-system/webapps/${webappName}";
+    vhostConf = ''
+      Alias /rompr ${root}
 
-        <Directory ${root}>
-          Options Indexes FollowSymLinks
-          DirectoryIndex index.php
-          AllowOverride all
-          Require all granted
-          Order allow,deny
-          Allow from all
-          ErrorDocument 404 /rompr/404.php
-          AddType image/x-icon .ico
+      <Directory ${root}>
+        Options Indexes FollowSymLinks
+        DirectoryIndex index.php
+        AllowOverride all
+        Require all granted
+        Order allow,deny
+        Allow from all
+        ErrorDocument 404 /rompr/404.php
+        AddType image/x-icon .ico
 
-          <FilesMatch "\.php$">
-            SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
-          </FilesMatch>
-        </Directory>
+        <FilesMatch "\.php$">
+          SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
+        </FilesMatch>
+      </Directory>
 
-        <Directory ${root}/albumart/small>
-            Header Set Cache-Control "max-age=0, no-store"
-            Header Set Cache-Control "no-cache, must-revalidate"
-        </Directory>
+      <Directory ${root}/albumart/small>
+          Header Set Cache-Control "max-age=0, no-store"
+          Header Set Cache-Control "no-cache, must-revalidate"
+      </Directory>
 
-        <Directory ${root}/albumart/asdownloaded>
-            Header Set Cache-Control "max-age=0, no-store"
-            Header Set Cache-Control "no-cache, must-revalidate"
-        </Directory>
+      <Directory ${root}/albumart/asdownloaded>
+          Header Set Cache-Control "max-age=0, no-store"
+          Header Set Cache-Control "no-cache, must-revalidate"
+      </Directory>
 
-        <LocationMatch "^/rompr">
-          Use LDAPConnect
-          Require ldap-group   cn=users,cn=mpd,ou=services,dc=immae,dc=eu
-        </LocationMatch>
-        '';
-    };
-    phpFpm = rec {
-      basedir = builtins.concatStringsSep ":" [ webRoot varDir ];
-      socket = "/var/run/phpfpm/rompr.sock";
-      pool = ''
-        listen = ${socket}
-        user = ${apache.user}
-        group = ${apache.group}
-        listen.owner = ${apache.user}
-        listen.group = ${apache.group}
-        pm = ondemand
-        pm.max_children = 60
-        pm.process_idle_timeout = 60
+      <LocationMatch "^/rompr">
+        Use LDAPConnect
+        Require ldap-group   cn=users,cn=mpd,ou=services,dc=immae,dc=eu
+      </LocationMatch>
+      '';
+  };
+  phpFpm = rec {
+    basedir = builtins.concatStringsSep ":" [ webRoot varDir ];
+    socket = "/var/run/phpfpm/rompr.sock";
+    pool = ''
+      listen = ${socket}
+      user = ${apache.user}
+      group = ${apache.group}
+      listen.owner = ${apache.user}
+      listen.group = ${apache.group}
+      pm = ondemand
+      pm.max_children = 60
+      pm.process_idle_timeout = 60
 
-        ; Needed to avoid clashes in browser cookies (same domain)
-        php_value[session.name] = RomprPHPSESSID
-        php_admin_value[open_basedir] = "${basedir}:/tmp"
-        php_admin_value[session.save_path] = "${varDir}/phpSessions"
-        php_flag[magic_quotes_gpc] = Off
-        php_flag[track_vars] = On
-        php_flag[register_globals] = Off
-        php_admin_flag[allow_url_fopen] = On
-        php_value[include_path] = ${webRoot}
-        php_admin_value[upload_tmp_dir] = "${varDir}/prefs"
-        php_admin_value[post_max_size] = 32M
-        php_admin_value[upload_max_filesize] = 32M
-        php_admin_value[memory_limit] = 256M
-        '';
-    };
+      ; Needed to avoid clashes in browser cookies (same domain)
+      php_value[session.name] = RomprPHPSESSID
+      php_admin_value[open_basedir] = "${basedir}:/tmp"
+      php_admin_value[session.save_path] = "${varDir}/phpSessions"
+      php_flag[magic_quotes_gpc] = Off
+      php_flag[track_vars] = On
+      php_flag[register_globals] = Off
+      php_admin_flag[allow_url_fopen] = On
+      php_value[include_path] = ${webRoot}
+      php_admin_value[upload_tmp_dir] = "${varDir}/prefs"
+      php_admin_value[post_max_size] = 32M
+      php_admin_value[upload_max_filesize] = 32M
+      php_admin_value[memory_limit] = 256M
+      '';
   };
-in
-  rompr
+}
index 7e04e8d498d4a558f365769d3a7d70365bcc80b0..50c3543b84443a17662bbadfdded6d4b0d223c77 100644 (file)
@@ -23,4 +23,6 @@ rec {
       (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; });
 
   phpldapadmin = callPackage ./phpldapadmin {};
+
+  rompr = callPackage ./rompr { inherit mylibs; };
 }
diff --git a/pkgs/webapps/rompr/default.nix b/pkgs/webapps/rompr/default.nix
new file mode 100644 (file)
index 0000000..2accf00
--- /dev/null
@@ -0,0 +1,8 @@
+{ varDir ? "/var/lib/rompr", stdenv, mylibs }:
+stdenv.mkDerivation (mylibs.fetchedGithub ./rompr.json // {
+  installPhase = ''
+        cp -a . $out
+        ln -sf ${varDir}/prefs $out/prefs
+        ln -sf ${varDir}/albumart $out/albumart
+  '';
+})