mount network drives only
This commit is contained in:
@@ -18,12 +18,6 @@ let
|
||||
device = "//10.0.0.65/wd4tb";
|
||||
mountPoint = "/mnt/smb-wd4tb";
|
||||
}
|
||||
{
|
||||
name = "stashapp";
|
||||
device = "//10.0.0.65/stashapp";
|
||||
mountPoint = "/mnt/smb-app";
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
networkFileSystems = builtins.listToAttrs (map (share: {
|
||||
@@ -34,59 +28,23 @@ let
|
||||
options = [
|
||||
"username=${secrets."${share.name}Username"}"
|
||||
"password=${secrets."${share.name}Password"}"
|
||||
"uid=1000"
|
||||
"gid=1000"
|
||||
"uid=${toString uid}"
|
||||
"gid=${toString gid}"
|
||||
"file_mode=0775"
|
||||
"dir_mode=0775"
|
||||
"nofail" # <<< ADDED: Don't fail boot if network is down
|
||||
"_netdev" # <<< ADDED: Wait for network
|
||||
];
|
||||
};
|
||||
}) networkShares);
|
||||
in
|
||||
{
|
||||
# Only add network shares and NVMe
|
||||
# Root and boot are already in hardware-configuration.nix
|
||||
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";
|
||||
};
|
||||
# Only network shares - NO NVMe for now
|
||||
fileSystems = networkFileSystems;
|
||||
|
||||
# Create symlinks in home directory for easy access
|
||||
systemd.tmpfiles.rules =
|
||||
(map (share:
|
||||
"L+ /home/${username}/${share.name} - - - - ${share.mountPoint}"
|
||||
) networkShares)
|
||||
++
|
||||
[
|
||||
"L+ /home/${username}/nvme - - - - /mnt/nvme"
|
||||
"d /mnt/nvme/games 0775 ${username} users -"
|
||||
"d /mnt/nvme/games/steam 0775 ${username} users -"
|
||||
];
|
||||
}
|
||||
systemd.tmpfiles.rules = map (share:
|
||||
"L+ /home/${username}/${share.name} - - - - ${share.mountPoint}"
|
||||
) networkShares;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user