From 15b0ef64c04e1a84a203b3289c2dce319f4668e9 Mon Sep 17 00:00:00 2001
From: makefu <github@syntax-fehler.de>
Date: Sat, 16 Jan 2016 01:30:37 +0100
Subject: [PATCH] ma 2 default: useroaming no, omo: provide share

---
 1systems/omo.nix             |  4 ++--
 2configs/default.nix         |  7 ++++++-
 2configs/nginx/omo-share.nix | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 2configs/nginx/omo-share.nix

diff --git a/1systems/omo.nix b/1systems/omo.nix
index 2a65799..e11665f 100644
--- a/1systems/omo.nix
+++ b/1systems/omo.nix
@@ -28,11 +28,11 @@ in {
       ../2configs/smart-monitor.nix
       ../2configs/mail-client.nix
       ../2configs/share-user-sftp.nix
+      ../2configs/nginx/omo-share.nix
       ../3modules
     ];
   # services.openssh.allowSFTP = false;
   krebs.build.host = config.krebs.hosts.omo;
-  
 
   # copy config from <secrets/sabnzbd.ini> to /var/lib/sabnzbd/
   services.sabnzbd.enable = true;
@@ -98,7 +98,7 @@ in {
 
   networking.firewall.allowedUDPPorts = [ 655 ];
   # 8080: sabnzbd
-  networking.firewall.allowedTCPPorts = [ 655 8080 ];
+  networking.firewall.allowedTCPPorts = [ 80 655 8080 ];
 
   hardware.enableAllFirmware = true;
   hardware.cpu.amd.updateMicrocode = true;
diff --git a/2configs/default.nix b/2configs/default.nix
index 7593eaf..7771e24 100644
--- a/2configs/default.nix
+++ b/2configs/default.nix
@@ -65,7 +65,12 @@ with lib;
   time.timeZone = "Europe/Berlin";
   #nix.maxJobs = 1;
 
-  programs.ssh.startAgent = false;
+  programs.ssh = {
+    startAgent = false;
+    extraConfig = ''
+      UseRoaming no
+    '';
+  };
   services.openssh.enable = true;
   nix.useChroot = true;
 
diff --git a/2configs/nginx/omo-share.nix b/2configs/nginx/omo-share.nix
new file mode 100644
index 0000000..ce85e04
--- /dev/null
+++ b/2configs/nginx/omo-share.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  hostname = config.krebs.build.host.name;
+  # TODO local-ip from the nets config
+  local-ip = "192.168.1.11";
+  # local-ip = head config.krebs.build.host.nets.retiolum.addrs4;
+in {
+  krebs.nginx = {
+    enable = mkDefault true;
+    servers = {
+      omo-share = {
+        listen = [ "${local-ip}:80" ];
+        locations = singleton (nameValuePair "/" ''
+          autoindex on;
+          root /media;
+          limit_rate_after 100m;
+          limit_rate 5m;
+          mp4_buffer_size     4M;
+          mp4_max_buffer_size 10M;
+          allow all;
+          access_log off;
+          keepalive_timeout  65;
+          keepalive_requests 200;
+          reset_timedout_connection on;
+          sendfile on;
+          tcp_nopush on;
+          gzip off;
+        '');
+      };
+    };
+  };
+}