mount network drives only

This commit is contained in:
2025-12-12 22:14:18 -05:00
parent 8c9c1162bf
commit 95435fb454

View File

@@ -18,12 +18,6 @@ let
device = "//10.0.0.65/wd4tb"; device = "//10.0.0.65/wd4tb";
mountPoint = "/mnt/smb-wd4tb"; mountPoint = "/mnt/smb-wd4tb";
} }
{
name = "stashapp";
device = "//10.0.0.65/stashapp";
mountPoint = "/mnt/smb-app";
}
]; ];
networkFileSystems = builtins.listToAttrs (map (share: { networkFileSystems = builtins.listToAttrs (map (share: {
@@ -34,59 +28,23 @@ let
options = [ options = [
"username=${secrets."${share.name}Username"}" "username=${secrets."${share.name}Username"}"
"password=${secrets."${share.name}Password"}" "password=${secrets."${share.name}Password"}"
"uid=1000" "uid=${toString uid}"
"gid=1000" "gid=${toString gid}"
"file_mode=0775" "file_mode=0775"
"dir_mode=0775" "dir_mode=0775"
"nofail" # <<< ADDED: Don't fail boot if network is down
"_netdev" # <<< ADDED: Wait for network
]; ];
}; };
}) networkShares); }) networkShares);
in in
{ {
# Only add network shares and NVMe # Only network shares - NO NVMe for now
# Root and boot are already in hardware-configuration.nix fileSystems = networkFileSystems;
fileSystems = networkFileSystems // {
# Your new NVMe drive ONLY
"/mnt/nvme" = {
device = "/dev/disk/by-label/nvmedrive";
fsType = "ext4";
options = [
"defaults"
"noatime"
"discard"
"uid=${toString uid}"
"gid=${toString gid}"
"fmask=022"
"dmask=022"
];
};
};
systemd.services.fix-nvme-permissions = {
description = "Fix NVMe drive permissions";
wantedBy = [ "multi-user.target" ];
after = [ "local-fs.target" ];
script = ''
# Set ownership
chown -R ${username}:users /mnt/nvme 2>/dev/null || true
# Create game directories
mkdir -p /mnt/nvme/games/steam
chown -R ${username}:users /mnt/nvme/games
# Set permissions
chmod -R 775 /mnt/nvme 2>/dev/null || true
'';
serviceConfig.Type = "oneshot";
};
# Create symlinks in home directory for easy access # Create symlinks in home directory for easy access
systemd.tmpfiles.rules = systemd.tmpfiles.rules = map (share:
(map (share:
"L+ /home/${username}/${share.name} - - - - ${share.mountPoint}" "L+ /home/${username}/${share.name} - - - - ${share.mountPoint}"
) networkShares) ) networkShares;
++
[
"L+ /home/${username}/nvme - - - - /mnt/nvme"
"d /mnt/nvme/games 0775 ${username} users -"
"d /mnt/nvme/games/steam 0775 ${username} users -"
];
} }