summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
Diffstat (limited to 'lass')
-rw-r--r--lass/1systems/mors.nix19
-rw-r--r--lass/1systems/prism.nix24
-rw-r--r--lass/2configs/browsers.nix1
-rw-r--r--lass/2configs/default.nix5
-rw-r--r--lass/2configs/exim-smarthost.nix2
-rw-r--r--lass/2configs/git.nix7
-rw-r--r--lass/2configs/radio.nix72
-rw-r--r--lass/2configs/websites/domsen.nix76
-rw-r--r--lass/2configs/websites/fritz.nix75
-rw-r--r--lass/2configs/websites/sqlBackup.nix28
-rw-r--r--lass/2configs/websites/util.nix229
-rw-r--r--lass/2configs/websites/wohnprojekt-rhh.de.nix10
-rw-r--r--lass/4lib/default.nix223
13 files changed, 440 insertions, 331 deletions
diff --git a/lass/1systems/mors.nix b/lass/1systems/mors.nix
index e2ab562fa..a7a1fd253 100644
--- a/lass/1systems/mors.nix
+++ b/lass/1systems/mors.nix
@@ -14,7 +14,7 @@
../2configs/elster.nix
../2configs/steam.nix
../2configs/wine.nix
- ../2configs/texlive.nix
+ #../2configs/texlive.nix
../2configs/binary-caches.nix
#../2configs/ircd.nix
../2configs/chromium-patched.nix
@@ -175,14 +175,14 @@
emulateWheel = true;
};
- #services.xserver = {
- # videoDriver = "intel";
- # vaapiDrivers = [ pkgs.vaapiIntel ];
- # deviceSection = ''
- # Option "AccelMethod" "sna"
- # BusID "PCI:0:2:0"
- # '';
- #};
+ services.xserver = {
+ videoDriver = "intel";
+ vaapiDrivers = [ pkgs.vaapiIntel ];
+ deviceSection = ''
+ Option "AccelMethod" "sna"
+ BusID "PCI:0:2:0"
+ '';
+ };
environment.systemPackages = with pkgs; [
acronym
@@ -193,6 +193,7 @@
hashPassword
urban
mk_sql_pair
+ remmina
];
#TODO: fix this shit
diff --git a/lass/1systems/prism.nix b/lass/1systems/prism.nix
index aa524720d..6ed80ac39 100644
--- a/lass/1systems/prism.nix
+++ b/lass/1systems/prism.nix
@@ -3,8 +3,9 @@
let
ip = config.krebs.build.host.nets.internet.ip4.addr;
- inherit (import ../../4lib { inherit lib pkgs; })
- manageCerts;
+ inherit (import <stockholm/lass/2configs/websites/util.nix> {inherit lib pkgs;})
+ manageCerts
+ ;
in {
imports = [
@@ -12,16 +13,19 @@ in {
../2configs/default.nix
../2configs/exim-smarthost.nix
../2configs/downloading.nix
- ../2configs/git.nix
../2configs/ts3.nix
../2configs/bitlbee.nix
../2configs/weechat.nix
../2configs/privoxy-retiolum.nix
../2configs/radio.nix
+ ../2configs/buildbot-standalone.nix
{
- #we need to use old sqlite for buildbot
imports = [
- ../2configs/buildbot-standalone.nix
+ ../2configs/git.nix
+ ( manageCerts [ "cgit.lassul.us" ])
+ ];
+ krebs.nginx.servers.cgit.server-names = [
+ "cgit.lassul.us"
];
}
{
@@ -196,6 +200,16 @@ in {
{ predicate = "-p tcp --dport xmpp-server"; target = "ACCEPT"; }
];
}
+ {
+ imports = [
+ ../2configs/realwallpaper-server.nix
+ ];
+ krebs.nginx.servers."lassul.us".locations = [
+ (lib.nameValuePair "/wallpaper.png" ''
+ alias /tmp/wallpaper.png;
+ '')
+ ];
+ }
];
krebs.build.host = config.krebs.hosts.prism;
diff --git a/lass/2configs/browsers.nix b/lass/2configs/browsers.nix
index e230fff43..ea79053ce 100644
--- a/lass/2configs/browsers.nix
+++ b/lass/2configs/browsers.nix
@@ -63,5 +63,6 @@ in {
( createChromiumUser "wk" [ "video" "audio" ] [ pkgs.chromium ] )
( createChromiumUser "fb" [ "video" "audio" ] [ pkgs.chromium ] )
( createChromiumUser "gm" [ "video" "audio" ] [ pkgs.chromium ] )
+ ( createChromiumUser "com" [ "video" "audio" ] [ pkgs.chromium ] )
];
}
diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix
index ee320b9c9..1c06acf38 100644
--- a/lass/2configs/default.nix
+++ b/lass/2configs/default.nix
@@ -30,6 +30,7 @@ with config.krebs.lib;
createHome = true;
useDefaultShell = true;
extraGroups = [
+ "fuse"
];
openssh.authorizedKeys.keys = [
config.krebs.users.lass.pubkey
@@ -55,8 +56,8 @@ with config.krebs.lib;
#secrets-common = "/home/lass/secrets/common";
stockholm = "/home/lass/stockholm";
nixpkgs = {
- url = https://github.com/NixOS/nixpkgs;
- rev = "d541e0dc1c05f5514bf30f8039e687adddb45616";
+ url = https://github.com/lassulus/nixpkgs;
+ rev = "f632f8edaf80ffa8bf0b8c9b9064cae3ccbe3894";
dev = "/home/lass/src/nixpkgs";
};
} // optionalAttrs config.krebs.build.host.secure {
diff --git a/lass/2configs/exim-smarthost.nix b/lass/2configs/exim-smarthost.nix
index 84a57205b..8199f2bd7 100644
--- a/lass/2configs/exim-smarthost.nix
+++ b/lass/2configs/exim-smarthost.nix
@@ -26,6 +26,8 @@ with config.krebs.lib;
{ from = "steuer@aidsballs.de"; to = lass.mail; }
{ from = "lass@aidsballs.de"; to = lass.mail; }
{ from = "wordpress@ubikmedia.de"; to = lass.mail; }
+ { from = "finanzamt@lassul.us"; to = lass.mail; }
+ { from = "dominik@apanowicz.de"; to = "dma@ubikmedia.eu"; }
];
system-aliases = [
{ from = "mailer-daemon"; to = "postmaster"; }
diff --git a/lass/2configs/git.nix b/lass/2configs/git.nix
index 5cbe46351..aac3f6e02 100644
--- a/lass/2configs/git.nix
+++ b/lass/2configs/git.nix
@@ -37,6 +37,8 @@ let
realwallpaper = {};
xmonad-stockholm = {};
the_playlist = {};
+ } // mapAttrs make-public-repo-silent {
+ the_playlist = {};
};
restricted-repos = mapAttrs make-restricted-repo (
@@ -64,6 +66,11 @@ let
};
};
+ make-public-repo-silent = name: { desc ? null, ... }: {
+ inherit name desc;
+ public = true;
+ };
+
make-restricted-repo = name: { collaborators ? [], desc ? null, ... }: {
inherit name collaborators desc;
public = false;
diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix
index 8cc2a2be7..17be327b9 100644
--- a/lass/2configs/radio.nix
+++ b/lass/2configs/radio.nix
@@ -1,4 +1,7 @@
{ config, pkgs, ... }:
+
+with config.krebs.lib;
+
let
name = "radio";
mainUser = config.users.extraUsers.mainUser;
@@ -7,6 +10,22 @@ let
admin-password = import <secrets/icecast-admin-pw>;
source-password = import <secrets/icecast-source-pw>;
+ add_random = pkgs.writeDashBin "add_random" ''
+ mpc add "$(mpc ls | shuf -n1)"
+ '';
+
+ skip_track = pkgs.writeDashBin "skip_track" ''
+ ${add_random}/bin/add_random
+ echo skipping: "$(${print_current}/bin/print_current)"
+ ${pkgs.mpc_cli}/bin/mpc -q next
+ '';
+
+ print_current = pkgs.writeDashBin "print_current" ''
+ echo "$(${pkgs.mpc_cli}/bin/mpc current -f %file%) \
+ $(${pkgs.mpc_cli}/bin/mpc current -f %file% \
+ | ${pkgs.gnused}/bin/sed 's@.*\(.\{11\}\)\.ogg@http://www.youtube.com/watch?v=\1@')"
+ '';
+
in {
users.users = {
"${name}" = rec {
@@ -28,6 +47,9 @@ in {
};
krebs.per-user.${name}.packages = with pkgs; [
+ add_random
+ skip_track
+ print_current
ncmpcpp
mpc_cli
tmux
@@ -100,10 +122,6 @@ in {
autoAdd = pkgs.writeDash "autoAdd" ''
LIMIT=$1 #in secconds
- addRandom () {
- mpc add "$(mpc ls | shuf -n1)"
- }
-
timeLeft () {
playlistDuration=$(mpc --format '%time%' playlist | awk -F ':' 'BEGIN{t=0} {t+=$1*60+$2} END{print t}')
currentTime=$(mpc status | awk '/^\[playing\]/ { sub(/\/.+/,"",$3); split($3,a,/:/); print a[1]*60+a[2] }')
@@ -111,7 +129,7 @@ in {
}
if test $(timeLeft) -le $LIMIT; then
- addRandom
+ ${add_random}/bin/add_random
fi
'';
in {
@@ -130,4 +148,48 @@ in {
ExecStart = "${autoAdd} 100";
};
};
+
+ krebs.Reaktor = {
+ enable = true;
+ nickname = "the_playlist|r";
+ channels = [ "#the_playlist" ];
+ extraEnviron = {
+ REAKTOR_HOST = "irc.freenode.org";
+ };
+ plugins = with pkgs.ReaktorPlugins; [
+ (buildSimpleReaktorPlugin "skip" {
+ script = "${skip_track}/bin/skip_track";
+ pattern = "^skip$";
+ })
+ (buildSimpleReaktorPlugin "current" {
+ script = "${print_current}/bin/print_current";
+ pattern = "^current$";
+ })
+ ];
+ };
+ krebs.nginx.servers."lassul.us".locations = let
+ html = pkgs.writeText "index.html" ''
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>lassulus playlist</title>
+ </head>
+ <body>
+ <div style="display:inline-block;margin:0px;padding:0px;overflow:hidden">
+ <iframe src="https://kiwiirc.com/client/irc.freenode.org/?nick=kiwi_test|?&theme=cli#the_playlist" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:95%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="95%" width="100%"></iframe>
+ </div>
+ <div style="position:absolute;bottom:1px;display:inline-block;background-color:red;">
+ <audio controls autoplay="autoplay"><source src="http://lassul.us:8000/radio.ogg" type="audio/ogg">Your browser does not support the audio element.</audio>
+ </div>
+ <!-- page content -->
+ </body>
+ </html>
+ '';
+ in [
+ (nameValuePair "/the_playlist" ''
+ default_type "text/html";
+ alias ${html};
+ '')
+ ];
}
diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix
index f31fccd51..45d09c3b9 100644
--- a/lass/2configs/websites/domsen.nix
+++ b/lass/2configs/websites/domsen.nix
@@ -1,14 +1,10 @@
{ config, pkgs, lib, ... }:
let
- inherit (config.krebs.lib)
+ inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; })
genid
- readFile
;
- inherit (import ../../4lib { inherit lib pkgs; })
- manageCert
- manageCerts
- activateACME
+ inherit (import <stockholm/lass/2configs/websites/util.nix> {inherit lib pkgs;})
ssl
servePage
serveOwncloud
@@ -26,49 +22,30 @@ let
in {
imports = [
- ( ssl [ "reich-gebaeudereinigung.de" ])
- ( servePage [ "reich-gebaeudereinigung.de" ])
+ ./sqlBackup.nix
+ (ssl [ "reich-gebaeudereinigung.de" ])
+ (servePage [ "reich-gebaeudereinigung.de" ])
- ( manageCerts [ "karlaskop.de" ])
- ( servePage [ "karlaskop.de" ])
+ (ssl [ "karlaskop.de" ])
+ (servePage [ "karlaskop.de" ])
- ( ssl [ "makeup.apanowicz.de" ])
- ( servePage [ "makeup.apanowicz.de" ])
+ (ssl [ "makeup.apanowicz.de" ])
+ (servePage [ "makeup.apanowicz.de" ])
- ( manageCerts [ "pixelpocket.de" ])
- ( servePage [ "pixelpocket.de" ])
+ (ssl [ "pixelpocket.de" ])
+ (servePage [ "pixelpocket.de" ])
- ( ssl [ "o.ubikmedia.de" ])
- ( serveOwncloud [ "o.ubikmedia.de" ])
+ (ssl [ "o.ubikmedia.de" ])
+ (serveOwncloud [ "o.ubikmedia.de" ])
- ( ssl [ "ubikmedia.de" "aldona.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ] )
- ( serveWordpress [ "ubikmedia.de" "*.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ] )
+ (ssl [ "ubikmedia.de" "aldona.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ])
+ (serveWordpress [ "ubikmedia.de" "*.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ])
];
- services.mysql = {
- enable = true;
- package = pkgs.mariadb;
- rootPassword = toString (<secrets/mysql_rootPassword>);
- };
-
- lass.mysqlBackup = {
- enable = true;
- config.domsen = {
- password = toString (<secrets/mysql_rootPassword>);
- databases = [
- "ubikmedia_de"
- "o_ubikmedia_de"
- ];
- };
- };
- services.mysqlBackup = {
- enable = true;
- databases = [
- "ubikmedia_de"
- "o_ubikmedia_de"
- ];
- location = "/bku/sql_dumps";
- };
+ lass.mysqlBackup.config.all.databases = [
+ "ubikmedia_de"
+ "o_ubikmedia_de"
+ ];
users.users.domsen = {
uid = genid "domsen";
@@ -79,9 +56,18 @@ in {
createHome = true;
};
- services.phpfpm.phpOptions = ''
- extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so
- sendmail_path = ${sendmail} -t
+ #services.phpfpm.phpOptions = ''
+ # extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so
+ # sendmail_path = ${sendmail} -t
+ #'';
+ services.phpfpm.phpIni = pkgs.runCommand "php.ini" {
+ options = ''
+ extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so
+ sendmail_path = ${sendmail} -t -i"
+ '';
+ } ''
+ cat ${pkgs.php}/etc/php-recommended.ini > $out
+ echo "$options" >> $out
'';
}
diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix
index e35615040..63efbecb6 100644
--- a/lass/2configs/websites/fritz.nix
+++ b/lass/2configs/websites/fritz.nix
@@ -1,57 +1,54 @@
{ config, pkgs, lib, ... }:
let
- inherit (import ../../4lib { inherit lib pkgs; })
- manageCerts
- activateACME
+ inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; })
+ genid
+ head
+ nameValuePair
+ ;
+ inherit (import <stockholm/lass/2configs/websites/util.nix> {inherit lib pkgs;})
ssl
servePage
- serveWordpress;
+ serveWordpress
+ ;
in {
imports = [
- ( manageCerts [ "biostase.de" "www.biostase.de" ])
- #( serveWordpress [ "biostase.de" "www.biostase.de" ])
+ ./sqlBackup.nix
+ (ssl [ "biostase.de" "www.biostase.de" ])
+ (serveWordpress [ "biostase.de" "www.biostase.de" ])
- ( manageCerts [ "radical-dreamers.de" ])
- ( serveWordpress [ "radical-dreamers.de" ])
+ (ssl [ "radical-dreamers.de" "www.radical-dreamers.de" ])
+ (serveWordpress [ "radical-dreamers.de" "www.radical-dreamers.de" ])
- ( manageCerts [ "gs-maubach.de" ])
- ( serveWordpress [ "gs-maubach.de" ])
+ (ssl [ "gs-maubach.de" "www.gs-maubach.de" ])
+ (serveWordpress [ "gs-maubach.de" "www.gs-maubach.de" ])
- ( manageCerts [ "spielwaren-kern.de" ])
- ( serveWordpress [ "spielwaren-kern.de" ])
+ (ssl [ "spielwaren-kern.de" "www.spielwaren-kern.de" ])
+ (serveWordpress [ "spielwaren-kern.de" "www.spielwaren-kern.de" ])
- ( manageCerts [ "familienpraxis-korntal.de" ])
- ( servePage [ "familienpraxis-korntal.de" ])
+ (ssl [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ])
+ (servePage [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ])
- ( manageCerts [ "ttf-kleinaspach.de" ])
- ( serveWordpress [ "ttf-kleinaspach.de" ])
+ (ssl [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ])
+ (serveWordpress [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ])
- ( ssl [ "eastuttgart.de" ])
- ( serveWordpress [ "eastuttgart.de" ])
+ (ssl [ "eastuttgart.de" "www.eastuttgart.de" ])
+ (serveWordpress [ "eastuttgart.de" "www.eastuttgart.de" ])
- ( ssl [ "habsys.de" "habsys.eu" ])
- ( servePage [ "habsys.de" "habsys.eu" ])
+ (ssl [ "habsys.de" "www.habsys.de" "habsys.eu" "www.habsys.eu" ])
+ (servePage [ "habsys.de" "www.habsys.de" "habsys.eu" "www.habsys.eu" ])
];
- services.mysql = {
- enable = true;
- package = pkgs.mariadb;
- rootPassword = toString (<secrets/mysql_rootPassword>);
- };
-
- lass.mysqlBackup = {
- enable = true;
- config.fritz = {
- password = toString (<secrets/mysql_rootPassword>);
- databases = [
- "biostase_de"
- "eastuttgart_de"
- "radical_dreamers_de"
- "spielwaren_kern_de"
- "ttf_kleinaspach_de"
- ];
- };
- };
+ lass.mysqlBackup.config.all.databases = [
+ "biostase_de"
+ "eastuttgart_de"
+ "radical_dreamers_de"
+ "spielwaren_kern_de"
+ "ttf_kleinaspach_de"
+ ];
+
+ users.users.root.openssh.authorizedKeys.keys = [
+ config.krebs.users.fritz.pubkey
+ ];
}
diff --git a/lass/2configs/websites/sqlBackup.nix b/lass/2configs/websites/sqlBackup.nix
new file mode 100644
index 000000000..7cb4b320e
--- /dev/null
+++ b/lass/2configs/websites/sqlBackup.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+{
+ krebs.secret.files.mysql_rootPassword = {
+ path = "${config.services.mysql.dataDir}/mysql_rootPassword";
+ owner.name = "root";
+ source-path = toString <secrets> + "/mysql_rootPassword";
+ };
+
+ services.mysql = {
+ enable = true;
+ package = pkgs.mariadb;
+ rootPassword = config.krebs.secret.files.mysql_rootPassword.path;
+ };
+
+ systemd.services.mysql = {
+ requires = [ "secret.service" ];
+ after = [ "secret.service" ];
+ };
+
+ lass.mysqlBackup = {
+ enable = true;
+ config.all = {
+ password = toString (<secrets/mysql_rootPassword>);
+ };
+ };
+}
+
diff --git a/lass/2configs/websites/util.nix b/lass/2configs/websites/util.nix
new file mode 100644
index 000000000..330d8ba86
--- /dev/null
+++ b/lass/2configs/websites/util.nix
@@ -0,0 +1,229 @@
+{ lib, pkgs, ... }:
+
+with lib;
+
+rec {
+
+ manageCerts = domains:
+ let
+ domain = head domains;
+ in {
+ security.acme = {
+ certs."${domain}" = {
+ email = "lassulus@gmail.com";
+ webroot = "/var/lib/acme/challenges/${domain}";
+ plugins = [
+ "account_key.json"
+ "key.pem"
+ "fullchain.pem"
+ ];
+ group = "nginx";
+ allowKeysForGroup = true;
+ extraDomains = genAttrs domains (_: null);
+ };
+ };
+
+ krebs.nginx.servers."${domain}" = {
+ server-names = domains;
+ locations = [
+ (nameValuePair "/.well-known/acme-challenge" ''
+ root /var/lib/acme/challenges/${domain}/;
+ '')
+ ];
+ };
+ };
+
+ ssl = domains:
+ {
+ imports = [
+ ( manageCerts domains )
+ ( activateACME (head domains) )
+ ];
+ };
+
+ activateACME = domain:
+ {
+ krebs.nginx.servers.${domain} = {
+ ssl = {
+ enable = true;
+ certificate = "/var/lib/acme/${domain}/fullchain.pem";
+ certificate_key = "/var/lib/acme/${domain}/key.pem";
+ };
+ };
+ };
+
+ servePage = domains:
+ let
+ domain = head domains;
+ in {
+ krebs.nginx.servers.${domain} = {
+ server-names = domains;
+ locations = [
+ (nameValuePair "/" ''
+ root /srv/http/${domain};
+ '')
+ ];
+ };
+ };
+
+ serveOwncloud = domains:
+ let
+ domain = head domains;
+ in {
+ krebs.nginx.servers."${domain}" = {
+ server-names = domains;
+ extraConfig = ''
+ # Add headers to serve security related headers
+ add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
+ add_header X-Content-Type-Options nosniff;
+ add_header X-Frame-Options "SAMEORIGIN";
+ add_header X-XSS-Protection "1; mode=block";
+ add_header X-Robots-Tag none;
+
+ # Path to the root of your installation
+ root /srv/http/${domain}/;
+ # set max upload size
+ client_max_body_size 10G;
+ fastcgi_buffers 64 4K;
+
+ # Disable gzip to avoid the removal of the ETag header
+ gzip off;
+
+ # Uncomment if your server is build with the ngx_pagespeed module
+ # This module is currently not supported.
+ #pagespeed off;
+
+ index index.php;
+ error_page 403 /core/templates/403.php;
+ error_page 404 /core/templates/404.php;
+
+ rewrite ^/.well-known/carddav /remote.php/carddav/ permanent;
+ rewrite ^/.well-known/caldav /remote.php/caldav/ permanent;
+
+ # The following 2 rules are only needed for the user_webfinger app.
+ # Uncomment it if you're planning to use this app.
+ rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
+ rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
+ '';
+ locations = [
+ (nameValuePair "/robots.txt" ''
+ allow all;
+ log_not_found off;
+ access_log off;
+ '')
+ (nameValuePair "~ ^/(build|tests|config|lib|3rdparty|templates|data)/" ''
+ deny all;
+ '')
+
+ (nameValuePair "~ ^/(?:autotest|occ|issue|indie|db_|console)" ''
+ deny all;
+ '')
+
+ (nameValuePair "/" ''
+ rewrite ^/remote/(.*) /remote.php last;
+ rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
+ try_files $uri $uri/ =404;
+ '')
+
+ (nameValuePair "~ \.php(?:$|/)" ''
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ include ${pkgs.nginx}/conf/fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param HTTPS on;
+ fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
+ fastcgi_pass unix:/srv/http/${domain}/phpfpm.pool;
+ fastcgi_intercept_errors on;
+ '')
+
+ # Adding the cache control header for js and css files
+ # Make sure it is BELOW the location ~ \.php(?:$|/) { block
+ (nameValuePair "~* \.(?:css|js)$" ''
+ add_header Cache-Control "public, max-age=7200";
+ # Add headers to serve security related headers
+ add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
+ add_header X-Content-Type-Options nosniff;
+ add_header X-Frame-Options "SAMEORIGIN";
+ add_header X-XSS-Protection "1; mode=block";
+ add_header X-Robots-Tag none;
+ # Optional: Don't log access to assets
+ access_log off;
+ '')
+
+ # Optional: Don't log access to other assets
+ (nameValuePair "~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$" ''
+ access_log off;
+ '')
+ ];
+ };
+ services.phpfpm.poolConfigs."${domain}" = ''
+ listen = /srv/http/${domain}/phpfpm.pool
+ user = nginx
+ group = nginx
+ pm = dynamic
+ pm.max_children = 5
+ pm.start_servers = 2
+ pm.min_spare_servers = 1
+ pm.max_spare_servers = 3
+ listen.owner = nginx
+ listen.group = nginx
+ # errors to journal
+ php_admin_value[error_log] = 'stderr'
+ php_admin_flag[log_errors] = on
+ catch_workers_output = yes
+ '';
+ };
+
+ serveWordpress = domains:
+ let
+ domain = head domains;
+
+ in {
+ krebs.nginx.servers."${domain}" = {
+ server-names = domains;
+ extraConfig = ''
+ root /srv/http/${domain}/;
+ index index.php;
+ access_log /tmp/nginx_acc.log;
+ error_log /tmp/nginx_err.log;
+ error_page 404 /404.html;
+ error_page 500 502 503 504 /50x.html;
+ '';
+ locations = [
+ (nameValuePair "/" ''
+ try_files $uri $uri/ /index.php?$args;
+ '')
+ (nameValuePair "~ \.php$" ''
+ fastcgi_pass unix:/srv/http/${domain}/phpfpm.pool;
+ include ${pkgs.nginx}/conf/fastcgi.conf;
+ '')
+ #(nameValuePair "~ /\\." ''
+ # deny all;
+ #'')
+ #Directives to send expires headers and turn off 404 error logging.
+ (nameValuePair "~* ^.+\.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$" ''
+ access_log off;
+ log_not_found off;
+ expires max;
+ '')
+ ];
+ };
+ services.phpfpm.poolConfigs."${domain}" = ''
+ listen = /srv/http/${domain}/phpfpm.pool
+ user = nginx
+ group = nginx
+ pm = dynamic
+ pm.max_children = 5
+ pm.start_servers = 2
+ pm.min_spare_servers = 1
+ pm.max_spare_servers = 3
+ listen.owner = nginx
+ listen.group = nginx
+ # errors to journal
+ php_admin_value[error_log] = 'stderr'
+ php_admin_flag[log_errors] = on
+ catch_workers_output = yes
+ '';
+ };
+
+}
diff --git a/lass/2configs/websites/wohnprojekt-rhh.de.nix b/lass/2configs/websites/wohnprojekt-rhh.de.nix
index 858054531..fb1a58109 100644
--- a/lass/2configs/websites/wohnprojekt-rhh.de.nix
+++ b/lass/2configs/websites/wohnprojekt-rhh.de.nix
@@ -1,11 +1,13 @@
{ config, pkgs, lib, ... }:
let
- inherit (config.krebs.lib) genid;
- inherit (import ../../4lib { inherit lib pkgs; })
+ inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; })
+ genid
+ ;
+ inherit (import <stockholm/lass/2configs/websites/util.nix> {inherit lib pkgs;})
ssl
- servePage;
-
+ servePage
+ ;
in {
imports = [
( ssl [ "wohnprojekt-rhh.de" ])
diff --git a/lass/4lib/default.nix b/lass/4lib/default.nix
index 30cbced49..56943b7ac 100644
--- a/lass/4lib/default.nix
+++ b/lass/4lib/default.nix
@@ -1,4 +1,4 @@
-{ lib, pkgs, ... }:
+{ lib, ... }:
with lib;
@@ -7,225 +7,4 @@ rec {
getDefaultGateway = ip:
concatStringsSep "." (take 3 (splitString "." ip) ++ ["1"]);
- manageCerts = domains:
- let
- domain = head domains;
- in {
- security.acme = {
- certs."${domain}" = {
- email = "lassulus@gmail.com";
- webroot = "/var/lib/acme/challenges/${domain}";
- plugins = [
- "account_key.json"
- "key.pem"
- "fullchain.pem"
- ];
- group = "nginx";
- allowKeysForGroup = true;
- extraDomains = genAttrs domains (_: null);
- };
- };
-
- krebs.nginx.servers."${domain}" = {
- locations = [
- (nameValuePair "/.well-known/acme-challenge" ''
- root /var/lib/acme/challenges/${domain}/;
- '')
- ];
- };
- };
-
- ssl = domains:
- {
- imports = [
- ( manageCerts domains )
- ( activateACME (head domains) )
- ];
- };
-
- activateACME = domain:
- {
- krebs.nginx.servers."${domain}" = {
- ssl = {
- enable = true;
- certificate = "/var/lib/acme/${domain}/fullchain.pem";
- certificate_key = "/var/lib/acme/${domain}/key.pem";
- };
- };
- };
-
- servePage = domains:
- let
- domain = head domains;
- in {
- krebs.nginx.servers."${domain}" = {
- server-names = domains;
- locations = [
- (nameValuePair "/" ''
- root /srv/http/${domain};
- '')
- ];
- };
- };
-
- serveOwncloud = domains:
- let
- domain = head domains;
- in {
- krebs.nginx.servers."${domain}" = {
- server-names = domains;
- extraConfig = ''
- # Add headers to serve security related headers
- add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
- add_header X-Content-Type-Options nosniff;
- add_header X-Frame-Options "SAMEORIGIN";
- add_header X-XSS-Protection "1; mode=block";
- add_header X-Robots-Tag none;
-
- # Path to the root of your installation
- root /srv/http/${domain}/;
- # set max upload size
- client_max_body_size 10G;
- fastcgi_buffers 64 4K;
-
- # Disable gzip to avoid the removal of the ETag header
- gzip off;
-
- # Uncomment if your server is build with the ngx_pagespeed module
- # This module is currently not supported.
- #pagespeed off;
-
- index index.php;
- error_page 403 /core/templates/403.php;
- error_page 404 /core/templates/404.php;
-
- rewrite ^/.well-known/carddav /remote.php/carddav/ permanent;
- rewrite ^/.well-known/caldav /remote.php/caldav/ permanent;
-
- # The following 2 rules are only needed for the user_webfinger app.
- # Uncomment it if you're planning to use this app.
- rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
- rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
- '';
- locations = [
- (nameValuePair "/robots.txt" ''
- allow all;
- log_not_found off;
- access_log off;
- '')
- (nameValuePair "~ ^/(build|tests|config|lib|3rdparty|templates|data)/" ''
- deny all;
- '')
-
- (nameValuePair "~ ^/(?:autotest|occ|issue|indie|db_|console)" ''
- deny all;
- '')
-
- (nameValuePair "/" ''
- rewrite ^/remote/(.*) /remote.php last;
- rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
- try_files $uri $uri/ =404;
- '')
-
- (nameValuePair "~ \.php(?:$|/)" ''
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- include ${pkgs.nginx}/conf/fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param HTTPS on;
- fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
- fastcgi_pass unix:/srv/http/${domain}/phpfpm.pool;
- fastcgi_intercept_errors on;
- '')
-
- # Adding the cache control header for js and css files
- # Make sure it is BELOW the location ~ \.php(?:$|/) { block
- (nameValuePair "~* \.(?:css|js)$" ''
- add_header Cache-Control "public, max-age=7200";
- # Add headers to serve security related headers
- add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
- add_heade