From a1434cee4e7aa3a5004a6b1b091934b01196007e Mon Sep 17 00:00:00 2001 From: Matt Nish-Lapidus Date: Sat, 5 Apr 2025 13:53:10 -0400 Subject: [PATCH] switching all smb to nfs --- hosts/media-server/configuration.nix | 68 ++++++++++++++++------------ modules/system/filesystems-filez.nix | 31 +++++++------ 2 files changed, 56 insertions(+), 43 deletions(-) diff --git a/hosts/media-server/configuration.nix b/hosts/media-server/configuration.nix index 790d86f..d24a4bf 100644 --- a/hosts/media-server/configuration.nix +++ b/hosts/media-server/configuration.nix @@ -125,36 +125,48 @@ openFirewall = true; nssmdns4 = true; }; - services.samba = { - enable = true; - package = pkgs.sambaFull; - openFirewall = true; - settings = { - global = { - "workgroup" = "WORKGROUP"; - "server string" = "media-server"; - "netbios name" = "media-server"; - "security" = "user"; - # "hosts allow" = "192.168.50. 127.0.0.1 localhost"; - # "hosts deny" = "0.0.0.0/0"; - "guest account" = "nobody"; - "map to guest" = "bad user"; - }; - "import" = { - "path" = "/mnt/shares/import"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - "force user" = "media"; - }; + + services.rpcbind.enable = true; + + services.nfs = { + server = { + enable = true; + exports = '' +/mnt/shares/import *(rw,fsid=0,no_subtree_check) +''; }; }; - services.samba-wsdd = { - enable = true; - openFirewall = true; - }; + + # services.samba = { + # enable = true; + # package = pkgs.sambaFull; + # openFirewall = true; + # settings = { + # global = { + # "workgroup" = "WORKGROUP"; + # "server string" = "media-server"; + # "netbios name" = "media-server"; + # "security" = "user"; + # # "hosts allow" = "192.168.50. 127.0.0.1 localhost"; + # # "hosts deny" = "0.0.0.0/0"; + # "guest account" = "nobody"; + # "map to guest" = "bad user"; + # }; + # "import" = { + # "path" = "/mnt/shares/import"; + # "browseable" = "yes"; + # "read only" = "no"; + # "guest ok" = "no"; + # "create mask" = "0644"; + # "directory mask" = "0755"; + # "force user" = "media"; + # }; + # }; + # }; + # services.samba-wsdd = { + # enable = true; + # openFirewall = true; + # }; programs.nix-ld.enable = true; diff --git a/modules/system/filesystems-filez.nix b/modules/system/filesystems-filez.nix index db38cf7..eb29eae 100644 --- a/modules/system/filesystems-filez.nix +++ b/modules/system/filesystems-filez.nix @@ -1,35 +1,36 @@ { config, lib, pkgs, ... }: { + + services.rpcbind.enable = true; # needed for NFS + fileSystems = let - automount-opts = "x-systemd.automount,noauto,users,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,noperm,uid=1000"; - filez-opts = automount-opts + ",credentials=/etc/nixos/filez-secrets"; - # media-server-opts = automount-opts + ",credentials=/etc/nixos/media-server-secrets"; + opts = [ "nfsvers=4.1" "noatime" "noauto" ]; in { "/mnt/filez/media" = { - device = "//Filez/Media"; - fsType = "smb3"; - options = [ "${filez-opts}" ]; + device = "filez:/volume1/Media"; + fsType = "nfs"; + options = opts; }; "/mnt/filez/music-production" = { - device = "//Filez/Music Production"; - fsType = "smb3"; - options = [ "${filez-opts}" ]; + device = "filez:/volume1/Music Production"; + fsType = "nfs"; + options = opts; }; "/mnt/filez/storage" = { - device = "//Filez/Storage"; - fsType = "smb3"; - options = [ "${filez-opts}" ]; + device = "filez:/volume1/Storage"; + fsType = "nfs"; + options = opts; }; "/mnt/filez/photos" = { - device = "//Filez/Photo Storage"; - fsType = "smb3"; - options = [ "${filez-opts}" ]; + device = "filez:/volume1/Photo Storage"; + fsType = "nfs"; + options = opts; }; }; }