From aff3f9ac92851ac5a74d717f9081f66d4f57c807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Mon, 8 Apr 2024 08:17:52 +0200 Subject: [PATCH] feat: mount network devices under ~/remote --- configs/default.nix | 20 ++++++++++++++++++-- configs/fritzbox.nix | 19 ------------------- configs/fu-berlin.nix | 3 ++- configs/hu-berlin.nix | 5 +++-- lib/default.nix | 2 ++ systems/zaatar/mpd.nix | 15 ++++++++++++++- 6 files changed, 39 insertions(+), 25 deletions(-) delete mode 100644 configs/fritzbox.nix diff --git a/configs/default.nix b/configs/default.nix index 35ffeb9..d5cb9db 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -7,7 +7,7 @@ ... }: let inherit (lib.strings) makeBinPath; - inherit (import ../lib) localAddresses kieran; + inherit (import ../lib) localAddresses kieran remoteDir; defaultApplications = (import ../lib).defaultApplications {inherit pkgs;}; in { imports = [ @@ -264,7 +264,23 @@ in { ./zsh.nix ./tor.nix ./stw-berlin.nix - ./fritzbox.nix ./mastodon-bot.nix + { + fileSystems."${remoteDir}/fritz" = { + device = "//192.168.178.1/FRITZ.NAS/Backup"; + fsType = "cifs"; + options = [ + "username=ftpuser" + "password=ftppassword" + "noauto" + "nounix" + "rw" + "noserverino" # ref https://askubuntu.com/a/1265165 + "x-systemd.automount" + "x-systemd.device-timeout=1" + "x-systemd.idle-timeout=1min" + ]; + }; + } ]; } diff --git a/configs/fritzbox.nix b/configs/fritzbox.nix deleted file mode 100644 index 27612c0..0000000 --- a/configs/fritzbox.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - fileSystems."/media/fritz" = { - device = "//192.168.178.1/FRITZ.NAS/Backup"; - fsType = "cifs"; - options = [ - "username=ftpuser" - "password=ftppassword" - "guest" - "noauto" - "workgroup=WORKGROUP" - "rw" - "noserverino" # ref https://askubuntu.com/a/1265165 - "nounix" - "x-systemd.automount" - "x-systemd.device-timeout=1" - "x-systemd.idle-timeout=1min" - ]; - }; -} diff --git a/configs/fu-berlin.nix b/configs/fu-berlin.nix index 6613554..fc28d5a 100644 --- a/configs/fu-berlin.nix +++ b/configs/fu-berlin.nix @@ -6,6 +6,7 @@ }: let username = "meinhak99"; inherit (import ../lib/email.nix) defaults pronouns; + inherit (import ../lib) remoteDir; fu-defaults = rec { imap.host = "mail.zedat.fu-berlin.de"; imap.port = 993; @@ -84,7 +85,7 @@ in { "x-systemd.idle-timeout=1min" ]; in { - "/media/fu-berlin/zodiac" = { + "${remoteDir}/fu-berlin/zodiac" = { device = "//trove.storage.fu-berlin.de/GESCHKULT"; fsType = "cifs"; options = diff --git a/configs/hu-berlin.nix b/configs/hu-berlin.nix index f12bb89..2de40ed 100644 --- a/configs/hu-berlin.nix +++ b/configs/hu-berlin.nix @@ -5,6 +5,7 @@ ... }: let inherit (import ../lib/email.nix) defaults pronouns; + inherit (import ../lib) remoteDir; hu-defaults = { imap.host = "mailbox.cms.hu-berlin.de"; imap.port = 993; @@ -24,13 +25,13 @@ "x-systemd.idle-timeout=1min" ]; in { - fileSystems."/media/hu-berlin/germpro2" = { + fileSystems."${remoteDir}/hu-berlin/germpro2" = { device = "//hugerm31c.user.hu-berlin.de/germpro2/ling"; fsType = "cifs"; options = hu-berlin-cifs-options; }; - fileSystems."/media/hu-berlin/germhome" = { + fileSystems."${remoteDir}/hu-berlin/germhome" = { device = "//hugerm31c.user.hu-berlin.de/germhome/ling/meinhaki"; fsType = "cifs"; options = hu-berlin-cifs-options; diff --git a/lib/default.nix b/lib/default.nix index 2966726..fb01bbf 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -15,6 +15,8 @@ repository = "rest:http://${host}:${toString port}/"; }; + remoteDir = "/home/kfm/remote"; + firewall = lib: { accept = { source, diff --git a/systems/zaatar/mpd.nix b/systems/zaatar/mpd.nix index af4da2f..964d15b 100644 --- a/systems/zaatar/mpd.nix +++ b/systems/zaatar/mpd.nix @@ -8,7 +8,7 @@ inherit (import ../../lib) tmpfilesConfig; mukkeMountPoint = "/mnt/mukke"; - fritzboxMountPoint = "/media/fritz"; + fritzboxMountPoint = "/mnt/fritz"; streams = import ../../lib/streams.nix { di-fm-key = "%DI_FM_KEY%"; # TODO lib.strings.fileContents ; @@ -43,6 +43,19 @@ in { ]; }; + fileSystems."${fritzboxMountPoint}" = { + device = "//192.168.178.1/FRITZ.NAS/Backup"; + fsType = "cifs"; + options = [ + "username=ftpuser" + "password=ftppassword" + "noauto" + "nounix" + "ro" + "noserverino" # ref https://askubuntu.com/a/1265165 + ]; + }; + systemd.tmpfiles.rules = [ (tmpfilesConfig { type = "L+";