summaryrefslogtreecommitdiffstats
path: root/makefu/2configs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-09-02 22:12:33 +0200
committermakefu <github@syntax-fehler.de>2018-09-02 22:12:33 +0200
commitbf1747adb41e7c255f0c863b38cf446a70dcccab (patch)
tree0b9eccd53d6f0d4240c45ae97322cb94b5244098 /makefu/2configs
parent7ffc39781f7abe588376c392184cb1b7654bf659 (diff)
ma rompr: init (but will never use it)
Diffstat (limited to 'makefu/2configs')
-rw-r--r--makefu/2configs/nginx/rompr.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/makefu/2configs/nginx/rompr.nix b/makefu/2configs/nginx/rompr.nix
new file mode 100644
index 000000000..8c1fbc53b
--- /dev/null
+++ b/makefu/2configs/nginx/rompr.nix
@@ -0,0 +1,76 @@
+{ config, lib, pkgs, ... }:
+
+with import <stockholm/lib>;
+let
+ user = config.services.nginx.user;
+ group = config.services.nginx.group;
+ src = pkgs.fetchFromGitHub {
+ owner = "fatg3erman";
+ repo = "RompR";
+ rev = "1.21";
+ sha256 = "00gk2c610qgpsb6y296h9pz2aaa6gfq4cqhn15l7fdrk3lkvh01q";
+ };
+ fpm-socket = "/var/run/php5-rompr-fpm.sock";
+ mpd-src = "/var/lib/rompr";
+
+in {
+ services.phpfpm = {
+ # phpfpm does not have an enable option
+ poolConfigs = {
+ mpd = ''
+ user = ${user}
+ group = ${group}
+ listen = ${fpm-socket}
+ listen.owner = ${user}
+ listen.group = ${group}
+ pm = dynamic
+ pm.max_children = 5
+ pm.start_servers = 2
+ pm.min_spare_servers = 1
+ pm.max_spare_servers = 3
+ chdir = /
+ php_admin_value[error_log] = 'stderr'
+ php_admin_flag[log_errors] = on
+ catch_workers_output = yes
+ '';
+ };
+ };
+ # TODO: Pre-job
+ # TODO: prefs.var could be templated (serialized php ...) then we would not
+ # need to have a state dir at all
+ system.activationScripts.rompr = ''
+ mkdir -p ${mpd-src}
+ cp -r ${src}/. ${mpd-src}
+ chown -R ${user}:${group} ${mpd-src}
+ chmod 770 ${mpd-src}
+ '';
+ services.nginx = {
+ enable = mkDefault true;
+ virtualHosts = {
+ "localhost" = {
+ root = mpd-src;
+ locations."/".index = "index.php";
+ locations."~ \.php$" = {
+ root = mpd-src;
+ extraConfig = ''
+ client_max_body_size 200M;
+ fastcgi_pass unix:${fpm-socket};
+ include ${pkgs.nginx}/conf/fastcgi_params;
+ include ${pkgs.nginx}/conf/fastcgi.conf;
+ fastcgi_index index.php;
+ try_files $uri =404;
+ '';
+ };
+ };
+ };
+ };
+ services.mysql = {
+ enable = true;
+ package = pkgs.mariadb;
+ ensureDatabases = [ "romprdb" ];
+ ensureUsers = [
+ { ensurePermissions = { "romprdb.*" = "ALL PRIVILEGES"; };
+ name = user; }
+ ];
+ };
+}