Files
nixos/filesystem.nix
2025-12-12 22:14:18 -05:00

51 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
let
username = "brian";
uid = 1000;
gid = 100;
secrets = import ./secrets.nix;
networkShares = [
{
name = "seagate8tb";
device = "//10.0.0.128/PublicShare";
mountPoint = "/mnt/smb-seagate8tb";
}
{
name = "wd4tb";
device = "//10.0.0.65/wd4tb";
mountPoint = "/mnt/smb-wd4tb";
}
];
networkFileSystems = builtins.listToAttrs (map (share: {
name = share.mountPoint;
value = {
device = share.device;
fsType = "cifs";
options = [
"username=${secrets."${share.name}Username"}"
"password=${secrets."${share.name}Password"}"
"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 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;
}