From 2781b091a9de539222c12b7b4922a6aaba938754 Mon Sep 17 00:00:00 2001
From: makefu <github@syntax-fehler.de>
Date: Fri, 23 Sep 2022 23:01:58 +0200
Subject: [PATCH] ma share: proxy hetzner via gum

---
 2configs/share/gum-client.nix     | 23 +++++++++++++++--------
 2configs/share/gum.nix            |  9 ++-------
 2configs/share/hetzner-client.nix |  5 +++--
 2configs/share/omo.nix            |  6 ++++++
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/2configs/share/gum-client.nix b/2configs/share/gum-client.nix
index db2adfb..5192ef5 100644
--- a/2configs/share/gum-client.nix
+++ b/2configs/share/gum-client.nix
@@ -2,21 +2,28 @@
 
 let
   automount_opts =
-  [ "x-systemd.automount"
-    "noauto" "x-systemd.idle-timeout=600"
-    "x-systemd.device-timeout=5s"
-    "x-systemd.mount-timeout=5s"
+  [ "x-systemd.automount" "noauto" 
+    "x-systemd.idle-timeout=300"
+    "x-systemd.mount-timeout=60s"
   ];
-  host = "nextgum"; #TODO
+  host = "gum"; #TODO
 in {
-  fileSystems."/media/download" = {
-      device = "//${host}/download";
+  boot.extraModprobeConfig = ''
+    options cifs CIFSMaxBufSize=130048
+  '';
+  fileSystems."/media/cloud" = {
+      device = "//${host}/cloud-proxy";
       fsType = "cifs";
       options = automount_opts ++
       [ "credentials=/var/src/secrets/download.smb"
         "file_mode=0775"
         "dir_mode=0775"
-        "uid=9001"
+        "bsize=8388608"
+        "fsc"
+        "rsize=130048"
+        "cache=loose"
+        "uid=${toString config.users.users.download.uid}"
+        "gid=${toString config.users.groups.download.gid}"
         "vers=3"
       ];
   };
diff --git a/2configs/share/gum.nix b/2configs/share/gum.nix
index fd81f28..9647e0a 100644
--- a/2configs/share/gum.nix
+++ b/2configs/share/gum.nix
@@ -1,6 +1,5 @@
 { config, lib, pkgs, ... }:
 
-with import <stockholm/lib>;
 let
   hostname = config.krebs.build.host.name;
 in {
@@ -11,15 +10,11 @@ in {
   #   home = "/var/empty";
   # };
   environment.systemPackages = [ pkgs.samba ];
-  users.users.download = {
-    uid = genid "download";
-    isNormalUser = true;
-  };
   services.samba = {
     enable = true;
     shares = {
-      download = {
-        path = "/var/download";
+      cloud-proxy = {
+        path = "/media/cloud";
         "read only" = "no";
         browseable = "yes";
         "guest ok" = "no";
diff --git a/2configs/share/hetzner-client.nix b/2configs/share/hetzner-client.nix
index 90bc32d..dc86373 100644
--- a/2configs/share/hetzner-client.nix
+++ b/2configs/share/hetzner-client.nix
@@ -21,11 +21,12 @@ in {
         "dir_mode=0770"
         "uid=${toString config.users.users.download.uid}"
         "gid=${toString config.users.groups.download.gid}"
-        #"vers=3"
-        "vers=2.1"
+        "vers=3"
+        #"vers=2.1"
         "rsize=65536"
         "wsize=130048"
         "iocharset=utf8"
+        "cache=loose"
       ];
   };
 }
diff --git a/2configs/share/omo.nix b/2configs/share/omo.nix
index e53158b..4756ccf 100644
--- a/2configs/share/omo.nix
+++ b/2configs/share/omo.nix
@@ -87,6 +87,12 @@ in {
         "guest ok" = "no";
         "valid users" = "makefu";
       };
+      #cloud = {
+      #  path = "/media/cloud/download/finished";
+      #  "read only" = "no";
+      #  browseable = "yes";
+      #  "guest ok" = "yes";
+      #};
     };
     extraConfig = ''
       guest account = smbguest