aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/tools
diff options
context:
space:
mode:
Diffstat (limited to 'nixops/modules/websites/tools')
-rw-r--r--nixops/modules/websites/tools/tools/default.nix2
-rw-r--r--nixops/modules/websites/tools/tools/rompr.json15
-rw-r--r--nixops/modules/websites/tools/tools/rompr.nix150
3 files changed, 71 insertions, 96 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.json b/nixops/modules/websites/tools/tools/rompr.json
deleted file mode 100644
index 778d915..0000000
--- a/nixops/modules/websites/tools/tools/rompr.json
+++ /dev/null
@@ -1,15 +0,0 @@
1{
2 "tag": "1.24",
3 "meta": {
4 "name": "rompr",
5 "url": "https://github.com/fatg3erman/RompR",
6 "branch": "refs/tags/1.24"
7 },
8 "github": {
9 "owner": "fatg3erman",
10 "repo": "RompR",
11 "rev": "0d8f597027ac71b320963fe3f33f461a136312ad",
12 "sha256": "13p3c4whhmvz1vvh9fva5gdx4xji288k108hjdi8b1yn506lzix2",
13 "fetchSubmodules": true
14 }
15}
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