From 69526fea7723ea959857937f095ec481aa93d95f Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 2 Sep 2023 21:23:47 +0200 Subject: [PATCH] feat: added better samba mounts --- hosts/desktopnix/secrets/host.pub | 1 + hosts/patricknix/smb-mounts.nix | 31 ------------------ modules/optional/smb-mounts.nix | 42 +++++++++++++++++++++++++ users/common/graphical/sway/default.nix | 6 +++- users/patrick/default.nix | 1 + 5 files changed, 49 insertions(+), 32 deletions(-) delete mode 100644 hosts/patricknix/smb-mounts.nix create mode 100644 modules/optional/smb-mounts.nix diff --git a/hosts/desktopnix/secrets/host.pub b/hosts/desktopnix/secrets/host.pub index e69de29..640d8e7 100644 --- a/hosts/desktopnix/secrets/host.pub +++ b/hosts/desktopnix/secrets/host.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMIyksR1mSMNMBurwJTONANGLg/+SUOrbJz0u7G9XUdS root@desktopnix diff --git a/hosts/patricknix/smb-mounts.nix b/hosts/patricknix/smb-mounts.nix deleted file mode 100644 index 487d131..0000000 --- a/hosts/patricknix/smb-mounts.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - options = [ - "noauto" - "x-systemd.idle-timeout=60" - "x-systemd.device-timeout=5s" - "x-systemd.mount-timeout=5s" - "credentials=${config.age.secrets.smb-creds.path}" - "uid=${builtins.toString config.users.users.patrick.uid}" - "gid=${builtins.toString config.users.groups.patrick.gid}" - ]; -in { - environment.systemPackages = [pkgs.cifs-utils]; - age.secrets.smb-creds.rekeyFile = ../../secrets/smb.cred.age; - fileSystems = { - "/mnt/smb/patri-data" = { - device = "//10.0.0.1/patri-data"; - fsType = "cifs"; - inherit options; - }; - "/mnt/smb/patri-paperless" = { - device = "//10.0.0.1/patri-paperless"; - fsType = "cifs"; - inherit options; - }; - }; -} diff --git a/modules/optional/smb-mounts.nix b/modules/optional/smb-mounts.nix new file mode 100644 index 0000000..34d3fa7 --- /dev/null +++ b/modules/optional/smb-mounts.nix @@ -0,0 +1,42 @@ +userName: { + pkgs, + config, + ... +}: let + options = [ + "noauto" + "x-systemd.idle-timeout=60" + "x-systemd.device-timeout=5s" + "x-systemd.mount-timeout=5s" + "credentials=${config.age.secrets.smb-creds.path}" + "uid=${builtins.toString config.users.users.${userName}.uid}" + "gid=${builtins.toString config.users.groups.${userName}.gid}" + ]; +in { + environment.systemPackages = [pkgs.cifs-utils]; + age.secrets.smb-creds.rekeyFile = ../../secrets/smb.cred.age; + fileSystems = let + home = "/home/${userName}"; + in { + "${home}/smb/patri-data" = { + device = "//192.168.178.2/patri-data"; + fsType = "cifs"; + inherit options; + }; + "${home}/smb/ggr-data" = { + device = "//192.168.178.2/patri-paperless"; + fsType = "cifs"; + inherit options; + }; + "${home}/smb/media" = { + device = "//192.168.178.2/media"; + fsType = "cifs"; + inherit options; + }; + "${home}/smb/patri-paperless" = { + device = "//192.168.178.2/patri-paperless"; + fsType = "cifs"; + inherit options; + }; + }; +} diff --git a/users/common/graphical/sway/default.nix b/users/common/graphical/sway/default.nix index 6e06482..8509ee5 100644 --- a/users/common/graphical/sway/default.nix +++ b/users/common/graphical/sway/default.nix @@ -118,7 +118,11 @@ } { workspace = "2"; - output = "DP-3"; + output = "HDMI-A-1"; + } + { + workspace = "2"; + output = "DVI-D-1"; } ]; }; diff --git a/users/patrick/default.nix b/users/patrick/default.nix index 5a299d7..4222593 100644 --- a/users/patrick/default.nix +++ b/users/patrick/default.nix @@ -8,6 +8,7 @@ ../../modules/graphical/wayland.nix ../../modules/graphical/steam.nix (import ../../modules/impermanence/users.nix "patrick") + (import ../../modules/optional/smb-mounts.nix "patrick") ./impermanence.nix ];