summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-06-02 11:17:18 +0200
committermakefu <github@syntax-fehler.de>2016-06-02 11:17:18 +0200
commit4f28d9a306c2989304b52889c07e22992e40da0b (patch)
treed07166696ed3bd97bb6a165418af8611b8f68571
parentd5961aa09e399bb30f940eb5ac2cfe26dfa51d65 (diff)
parent7bd85d7bbbce68ba7317e16b805b1093ded3f1e2 (diff)
Merge remote-tracking branch 'prism/master'
-rw-r--r--krebs/3modules/iptables.nix2
-rw-r--r--krebs/3modules/lass/default.nix3
-rw-r--r--krebs/3modules/nginx.nix2
-rw-r--r--krebs/5pkgs/builders.nix51
-rw-r--r--krebs/5pkgs/default.nix14
-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
-rw-r--r--tv/2configs/vim.nix7
-rw-r--r--tv/2configs/xserver/Xmodmap.nix27
-rw-r--r--tv/2configs/xserver/default.nix87
-rw-r--r--tv/5pkgs/default.nix4
-rw-r--r--tv/5pkgs/xmonad-tv.nix (renamed from tv/5pkgs/xmonad-tv/Main.hs)56
-rw-r--r--tv/5pkgs/xmonad-tv/.gitignore1
-rw-r--r--tv/5pkgs/xmonad-tv/Makefile6
-rw-r--r--tv/5pkgs/xmonad-tv/xmonad.cabal18
26 files changed, 608 insertions, 441 deletions
diff --git a/krebs/3modules/iptables.nix b/krebs/3modules/iptables.nix
index 4b99873a1..bb06a9388 100644
--- a/krebs/3modules/iptables.nix
+++ b/krebs/3modules/iptables.nix
@@ -124,7 +124,7 @@ let
buildRule = tn: cn: rule:
#target validation test:
- assert (elem rule.target ([ "ACCEPT" "REJECT" "DROP" "QUEUE" "LOG" "RETURN" ] ++ (attrNames ts."${tn}"))) || hasPrefix "REDIRECT" rule.target;
+ assert (elem rule.target ([ "ACCEPT" "REJECT" "DROP" "QUEUE" "LOG" "RETURN" ] ++ (attrNames ts."${tn}"))) || hasPrefix "REDIRECT" rule.target || hasPrefix "DNAT" rule.target;
#predicate validation test:
#maybe use iptables-test
diff --git a/krebs/3modules/lass/default.nix b/krebs/3modules/lass/default.nix
index 03e067f35..65da85ac4 100644
--- a/krebs/3modules/lass/default.nix
+++ b/krebs/3modules/lass/default.nix
@@ -311,5 +311,8 @@ with config.krebs.lib;
pubkey = builtins.readFile ./ssh/shodan.rsa;
pgp.pubkeys.default = builtins.readFile ./pgp/shodan.pgp;
};
+ fritz = {
+ pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz34435NSXgj72YAOL4cIlRq/4yInKEyL9no+gymURoW5x1nkYpP0EK331e7UyQQSOdWOogRo6d7YHcFqNlYWv5xlYcHucIhgJwC4Zda1liVA+v7tSOJz2BjmFvOT3/qlcPS69f3zdLHZooz2C33uHX1FgGRXlxiA8dpqGnSr8o76QLZjuQkuDqr8reOspjO/RHCo2Moq0Xm5q9OgN1WLAZzupqt9A5lx567mRzYsRAr23pUxVN8T/tSCgDlPe4ktEjYX9CXLKfMyh9WuBVi+AuH4GFEWBT+AMpsHeF45w+w956x56mz0F5nYOQNK87gFr+Jr+mh2AF1ot2CxzrfTb fritz@scriptkiddiT540";
+ };
};
}
diff --git a/krebs/3modules/nginx.nix b/krebs/3modules/nginx.nix
index 6af93a570..fc7fcca6f 100644
--- a/krebs/3modules/nginx.nix
+++ b/krebs/3modules/nginx.nix
@@ -119,7 +119,7 @@ let
to-server = { server-names, listen, locations, extraConfig, ssl, ... }: ''
server {
- server_name ${toString server-names};
+ server_name ${toString (unique server-names)};
${concatMapStringsSep "\n" (x: indent "listen ${x};") listen}
${optionalString ssl.enable (indent ''
listen 443 ssl;
diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix
index 19169b186..39b91d144 100644
--- a/krebs/5pkgs/builders.nix
+++ b/krebs/5pkgs/builders.nix
@@ -66,7 +66,52 @@ rec {
mv "$textPath" $out
'';
- writeNixFromCabal = name: path: pkgs.runCommand name {} ''
- ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
- '';
+ writeHaskellBin =
+ k:
+ let
+ k' = parseDrvName k;
+ name = k'.name;
+ version = if k'.version != "" then k'.version else "0";
+ in
+ { build-depends ? ["base"] ++ depends
+ , depends ? []
+ , ghc-options ? ["-Wall" "-O3" "-threaded" "-rtsopts"]
+ , haskellPackages ? pkgs.haskellPackages
+ , license ? "WTFPL"
+ }:
+ main-text:
+ let
+ cabal-file = pkgs.writeText "${name}-${version}.cabal" ''
+ build-type: Simple
+ cabal-version: >= 1.2
+ name: ${name}
+ version: ${version}
+
+ executable ${name}
+ build-depends: ${concatStringsSep "," build-depends}
+ ghc-options: ${toString ghc-options}
+ main-is: ${main-file.name}
+ '';
+ main-file = pkgs.writeText "${name}-${version}.hs" main-text;
+ in
+ haskellPackages.mkDerivation rec {
+ inherit license version;
+ executableHaskellDepends = attrVals build-depends haskellPackages;
+ isExecutable = true;
+ isLibrary = false;
+ pname = name;
+ src = pkgs.runCommand "${name}-${version}-src" {} ''
+ install -D ${cabal-file} $out/${cabal-file.name}
+ install -D ${main-file} $out/${main-file.name}
+ '';
+ };
+
+ writeNixFromCabal =
+ trace (toString [
+ "The function `writeNixFromCabal` has been deprecated in favour of"
+ "`writeHaskellBin'."
+ ])
+ (name: path: pkgs.runCommand name {} ''
+ ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
+ '');
}
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index c96e71538..53fc4de44 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -36,13 +36,13 @@ with config.krebs.lib;
ReaktorPlugins = callPackage ./Reaktor/plugins.nix {};
- buildbot = callPackage <nixpkgs/pkgs/development/tools/build-managers/buildbot> {
- inherit (pkgs.pythonPackages) twisted jinja2;
- dateutil = pkgs.pythonPackages.dateutil_1_5;
- sqlalchemy_migrate_0_7 = pkgs.pythonPackages.sqlalchemy_migrate_func (pkgs.pythonPackages.sqlalchemy7.override {
- doCheck = false;
- });
- };
+ #buildbot = callPackage <nixpkgs/pkgs/development/tools/build-managers/buildbot> {
+ # inherit (pkgs.pythonPackages) twisted jinja2;
+ # dateutil = pkgs.pythonPackages.dateutil_1_5;
+ # sqlalchemy_migrate_0_7 = pkgs.pythonPackages.sqlalchemy_migrate_func (pkgs.pythonPackages.sqlalchemy7.override {
+ # doCheck = false;
+ # });
+ #};
# XXX symlinkJoin changed arguments somewhere around nixpkgs d541e0d
symlinkJoin = { name, paths, ... }@args: let
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_pa