Skip to content

Mounting File Shares

SSHFS

system.fsPackages = [ pkgs.sshfs ];

fileSystems."/mnt/share/video" = {
device = "user@10.0.0.100:/mnt/storage/media/video";
fsType = "sshfs";
options =
    [ # Filesystem options
    "allow_other"          # for non-root access
    "ro"                   # read only
    "default_permissions"

    SSH options
    "reconnect"              # handle connection drops
    "ServerAliveInterval=15" # keep connections alive
    "IdentityFile=/home/user/.ssh/sshfs"
    ];
};

fileSystems."/mnt/share/music" = {
device = "user@10.0.0.100:/mnt/storage/media/audio/music";
fsType = "sshfs";
options =
    [ # Filesystem options
    "allow_other"          # for non-root access
    "ro"                   # read only
    "default_permissions"

    SSH options
    "reconnect"              # handle connection drops
    "ServerAliveInterval=15" # keep connections alive
    "IdentityFile=/home/user/.ssh/sshfs"
    ];
};

Samba

# samba fileshare mount
  fileSystems."/mnt/share" = {
    device = "//192.168.1.164/video-share";
    fsType = "cifs";
    options = ["vers=3.0,credentials=/etc/nixos/smb-secrets,uid=1000,gid=100"];
  };