diff --git a/hosts/nixos/hs/system.nix b/hosts/nixos/hs/system.nix index 1714895..828050e 100644 --- a/hosts/nixos/hs/system.nix +++ b/hosts/nixos/hs/system.nix @@ -7,7 +7,6 @@ ../../../modules/wireguard.nix ../../../modules/podman.nix ../../../modules/traefik.nix - ../../../modules/nfs.nix ../../../modules/borg-client.nix ../../../modules/login-display.nix ]; @@ -194,15 +193,6 @@ ]; }; - - - # NFS file sharing configuration - services.nfs-custom = { - enable = true; - exportPath = "/mnt/storage/Media"; - allowedNetworks = [ "10.1.1.0/24" "10.2.2.0/24" ]; # LAN and WireGuard - }; - # Login display with SMART disk health status services.login-display = { enable = true; diff --git a/hosts/nixos/thinkpad/system.nix b/hosts/nixos/thinkpad/system.nix index 6ae1341..8dd561d 100644 --- a/hosts/nixos/thinkpad/system.nix +++ b/hosts/nixos/thinkpad/system.nix @@ -5,7 +5,6 @@ ./hardware-configuration.nix ../system-default.nix # Common NixOS system configuration ../../../modules/wireguard.nix - ../../../modules/autofs.nix ../../../modules/login-display.nix ]; @@ -318,12 +317,4 @@ showDiskUsage = true; }; - # AutoFS auto-mounting for remote NFS shares - services.autofs-custom = { - enable = true; - remoteHost = "lan.hs.yanlincs.com"; # Prefer LAN when at home - replicas = [ "10.2.2.20" ]; # Fallback to WireGuard when remote - mountPoint = "/mnt/hs-media"; - }; - } diff --git a/modules/autofs.nix b/modules/autofs.nix deleted file mode 100644 index 50800b4..0000000 --- a/modules/autofs.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.services.autofs-custom; -in - -{ - options.services.autofs-custom = { - enable = mkEnableOption "AutoFS automatic mounting"; - - remoteHost = mkOption { - type = types.str; - description = "Primary remote NFS server hostname or IP"; - }; - - mountPoint = mkOption { - type = types.str; - description = "Local mount point"; - }; - - replicas = mkOption { - type = types.listOf types.str; - default = []; - description = "Replica server hostnames or IPs for failover (in order of preference)"; - }; - }; - - config = mkIf cfg.enable ( - let - # Build server list: primary host followed by replicas - allHosts = [ cfg.remoteHost ] ++ cfg.replicas; - # For NFSv4 with fsid=0, the exported path becomes root, so mount as "/" - locations = "${concatStringsSep "," allHosts}:/"; - in - { - services.autofs = { - enable = true; - timeout = 300; - autoMaster = '' - /- /etc/auto.nfs --timeout=300 - ''; - }; - - # Create the auto.nfs map file - environment.etc."auto.nfs".text = '' - ${cfg.mountPoint} -fstype=nfs4,rw,soft,intr,noatime ${locations} - ''; - - systemd.tmpfiles.rules = [ - "d ${cfg.mountPoint} 0755 root root -" - ]; - - environment.systemPackages = [ pkgs.nfs-utils ]; - } - ); -} diff --git a/modules/nfs.nix b/modules/nfs.nix deleted file mode 100644 index 7793dce..0000000 --- a/modules/nfs.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, ... }: - -with lib; - -let - cfg = config.services.nfs-custom; -in - -{ - options.services.nfs-custom = { - enable = mkEnableOption "NFS server"; - - exportPath = mkOption { - type = types.str; - description = "Path to export via NFS"; - }; - - allowedNetworks = mkOption { - type = types.listOf types.str; - default = [ "10.2.2.0/24" ]; - description = "Networks allowed to access the export (CIDR)"; - }; - }; - - config = mkIf cfg.enable { - services.nfs.server = { - enable = true; - exports = '' - ${cfg.exportPath} ${concatStringsSep " " (map (net: "${net}(rw,sync,no_subtree_check,no_root_squash,fsid=0)") cfg.allowedNetworks)} - ''; - }; - }; -}