aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-06 01:41:39 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-06 01:41:39 +0200
commit5dbe7ba1ad4a46c71cbf0e189de3f3436a530c0d (patch)
tree51966ceedc5cf975e909c5760a5bb36c4832a13c
parentbee035b7eb4dfe65f9787ae85beb46cec33a5c2f (diff)
downloadNix-5dbe7ba1ad4a46c71cbf0e189de3f3436a530c0d.tar.gz
Nix-5dbe7ba1ad4a46c71cbf0e189de3f3436a530c0d.tar.zst
Nix-5dbe7ba1ad4a46c71cbf0e189de3f3436a530c0d.zip
Move rompr to pkgs
-rw-r--r--nixops/modules/websites/tools/tools/default.nix2
-rw-r--r--nixops/modules/websites/tools/tools/rompr.nix150
-rw-r--r--pkgs/webapps/default.nix2
-rw-r--r--pkgs/webapps/rompr/default.nix8
-rw-r--r--pkgs/webapps/rompr/rompr.json (renamed from nixops/modules/websites/tools/tools/rompr.json)0
5 files changed, 81 insertions, 81 deletions
diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix
index e872224..95679f6 100644
--- a/nixops/modules/websites/tools/tools/default.nix
+++ b/nixops/modules/websites/tools/tools/default.nix
@@ -23,7 +23,7 @@ let
23 env = myconfig.env.tools.yourls; 23 env = myconfig.env.tools.yourls;
24 }; 24 };
25 rompr = pkgs.callPackage ./rompr.nix { 25 rompr = pkgs.callPackage ./rompr.nix {
26 inherit (mylibs) fetchedGithub; 26 inherit (pkgs.webapps) rompr;
27 env = myconfig.env.tools.rompr; 27 env = myconfig.env.tools.rompr;
28 }; 28 };
29 shaarli = pkgs.callPackage ./shaarli.nix { 29 shaarli = pkgs.callPackage ./shaarli.nix {
diff --git a/nixops/modules/websites/tools/tools/rompr.nix b/nixops/modules/websites/tools/tools/rompr.nix
index ca93bea..fea59fc 100644
--- a/nixops/modules/websites/tools/tools/rompr.nix
+++ b/nixops/modules/websites/tools/tools/rompr.nix
@@ -1,87 +1,77 @@
1{ lib, env, stdenv, fetchedGithub }: 1{ lib, env, rompr }:
2let 2rec {
3 rompr = let 3 varDir = "/var/lib/rompr";
4 in rec { 4 activationScript = ''
5 varDir = "/var/lib/rompr"; 5 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
6 activationScript = '' 6 ${varDir}/prefs ${varDir}/albumart ${varDir}/phpSessions
7 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ 7 '';
8 ${varDir}/prefs ${varDir}/albumart ${varDir}/phpSessions 8 webRoot = rompr;
9 ''; 9 apache = rec {
10 webRoot = stdenv.mkDerivation (fetchedGithub ./rompr.json // rec { 10 user = "wwwrun";
11 installPhase = '' 11 group = "wwwrun";
12 cp -a . $out 12 modules = [ "headers" "mime" "proxy_fcgi" ];
13 ln -sf ${varDir}/prefs $out/prefs 13 webappName = "tools_rompr";
14 ln -sf ${varDir}/albumart $out/albumart 14 root = "/run/current-system/webapps/${webappName}";
15 ''; 15 vhostConf = ''
16 }); 16 Alias /rompr ${root}
17 apache = rec {
18 user = "wwwrun";
19 group = "wwwrun";
20 modules = [ "headers" "mime" "proxy_fcgi" ];
21 webappName = "tools_rompr";
22 root = "/run/current-system/webapps/${webappName}";
23 vhostConf = ''
24 Alias /rompr ${root}
25 17
26 <Directory ${root}> 18 <Directory ${root}>
27 Options Indexes FollowSymLinks 19 Options Indexes FollowSymLinks
28 DirectoryIndex index.php 20 DirectoryIndex index.php
29 AllowOverride all 21 AllowOverride all
30 Require all granted 22 Require all granted
31 Order allow,deny 23 Order allow,deny
32 Allow from all 24 Allow from all
33 ErrorDocument 404 /rompr/404.php 25 ErrorDocument 404 /rompr/404.php
34 AddType image/x-icon .ico 26 AddType image/x-icon .ico
35 27
36 <FilesMatch "\.php$"> 28 <FilesMatch "\.php$">
37 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" 29 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
38 </FilesMatch> 30 </FilesMatch>
39 </Directory> 31 </Directory>
40 32
41 <Directory ${root}/albumart/small> 33 <Directory ${root}/albumart/small>
42 Header Set Cache-Control "max-age=0, no-store" 34 Header Set Cache-Control "max-age=0, no-store"
43 Header Set Cache-Control "no-cache, must-revalidate" 35 Header Set Cache-Control "no-cache, must-revalidate"
44 </Directory> 36 </Directory>
45 37
46 <Directory ${root}/albumart/asdownloaded> 38 <Directory ${root}/albumart/asdownloaded>
47 Header Set Cache-Control "max-age=0, no-store" 39 Header Set Cache-Control "max-age=0, no-store"
48 Header Set Cache-Control "no-cache, must-revalidate" 40 Header Set Cache-Control "no-cache, must-revalidate"
49 </Directory> 41 </Directory>
50 42
51 <LocationMatch "^/rompr"> 43 <LocationMatch "^/rompr">
52 Use LDAPConnect 44 Use LDAPConnect
53 Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu 45 Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu
54 </LocationMatch> 46 </LocationMatch>
55 ''; 47 '';
56 }; 48 };
57 phpFpm = rec { 49 phpFpm = rec {
58 basedir = builtins.concatStringsSep ":" [ webRoot varDir ]; 50 basedir = builtins.concatStringsSep ":" [ webRoot varDir ];
59 socket = "/var/run/phpfpm/rompr.sock"; 51 socket = "/var/run/phpfpm/rompr.sock";
60 pool = '' 52 pool = ''
61 listen = ${socket} 53 listen = ${socket}
62 user = ${apache.user} 54 user = ${apache.user}
63 group = ${apache.group} 55 group = ${apache.group}
64 listen.owner = ${apache.user} 56 listen.owner = ${apache.user}
65 listen.group = ${apache.group} 57 listen.group = ${apache.group}
66 pm = ondemand 58 pm = ondemand
67 pm.max_children = 60 59 pm.max_children = 60
68 pm.process_idle_timeout = 60 60 pm.process_idle_timeout = 60
69 61
70 ; Needed to avoid clashes in browser cookies (same domain) 62 ; Needed to avoid clashes in browser cookies (same domain)
71 php_value[session.name] = RomprPHPSESSID 63 php_value[session.name] = RomprPHPSESSID
72 php_admin_value[open_basedir] = "${basedir}:/tmp" 64 php_admin_value[open_basedir] = "${basedir}:/tmp"
73 php_admin_value[session.save_path] = "${varDir}/phpSessions" 65 php_admin_value[session.save_path] = "${varDir}/phpSessions"
74 php_flag[magic_quotes_gpc] = Off 66 php_flag[magic_quotes_gpc] = Off
75 php_flag[track_vars] = On 67 php_flag[track_vars] = On
76 php_flag[register_globals] = Off 68 php_flag[register_globals] = Off
77 php_admin_flag[allow_url_fopen] = On 69 php_admin_flag[allow_url_fopen] = On
78 php_value[include_path] = ${webRoot} 70 php_value[include_path] = ${webRoot}
79 php_admin_value[upload_tmp_dir] = "${varDir}/prefs" 71 php_admin_value[upload_tmp_dir] = "${varDir}/prefs"
80 php_admin_value[post_max_size] = 32M 72 php_admin_value[post_max_size] = 32M
81 php_admin_value[upload_max_filesize] = 32M 73 php_admin_value[upload_max_filesize] = 32M
82 php_admin_value[memory_limit] = 256M 74 php_admin_value[memory_limit] = 256M
83 ''; 75 '';
84 };
85 }; 76 };
86in 77}
87 rompr
diff --git a/pkgs/webapps/default.nix b/pkgs/webapps/default.nix
index 7e04e8d..50c3543 100644
--- a/pkgs/webapps/default.nix
+++ b/pkgs/webapps/default.nix
@@ -23,4 +23,6 @@ rec {
23 (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; }); 23 (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; });
24 24
25 phpldapadmin = callPackage ./phpldapadmin {}; 25 phpldapadmin = callPackage ./phpldapadmin {};
26
27 rompr = callPackage ./rompr { inherit mylibs; };
26} 28}
diff --git a/pkgs/webapps/rompr/default.nix b/pkgs/webapps/rompr/default.nix
new file mode 100644
index 0000000..2accf00
--- /dev/null
+++ b/pkgs/webapps/rompr/default.nix
@@ -0,0 +1,8 @@
1{ varDir ? "/var/lib/rompr", stdenv, mylibs }:
2stdenv.mkDerivation (mylibs.fetchedGithub ./rompr.json // {
3 installPhase = ''
4 cp -a . $out
5 ln -sf ${varDir}/prefs $out/prefs
6 ln -sf ${varDir}/albumart $out/albumart
7 '';
8})
diff --git a/nixops/modules/websites/tools/tools/rompr.json b/pkgs/webapps/rompr/rompr.json
index 778d915..778d915 100644
--- a/nixops/modules/websites/tools/tools/rompr.json
+++ b/pkgs/webapps/rompr/rompr.json