feat(nas): use samba share for temporary access to data
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-02-28 02:24:35 -05:00
parent 6a4ca65974
commit c57808ae7a

View file

@ -1,35 +1,28 @@
{ {pkgs, ...}: let
config, fsPkgs = with pkgs; [mergerfs cifs-utils];
pkgs,
...
}: let
inherit (config.sops) secrets;
fsPkgs = with pkgs; [fuse mergerfs sshfs];
sshfsOpts = [
"IdentityFile=${secrets.sshfs.path}"
"allow_other" # for non-root access
"_netdev" # requires network to mount
"x-systemd.automount" # mount on demand
# Handle connection drops better
"ServerAliveInterval=15"
"reconnect"
"defaults"
];
in { in {
# For sshfs permissions
programs.fuse.userAllowOther = true;
programs.ssh.knownHosts = {
"10.0.0.121".publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDs4eTQxAU+/B3B3AYXbTeRIZGk6lUKlykWrZZ07r3NMIJkleEE7i5KgW8QeeWVLFG8Thi4jyVferM7tPILA//Q6GXNDQ3ioYHExG33d/yIRGStD3rEizAv0LkDHavZ33VDNEOkBLQ22eeB7cCaQvsUoCbryo6w3mSQO5PDH9RE44XrOaSCbLvjhst5Z9gXPtrJsBcvOFUpdwz5gIHIqTFo6fQpmzxYkY5GrMaqMB75Xh2MQNkIZteC2MMPgIH9Vz+Q3CnzyiXEzoYaUtT0//sXnydagWWt9xf+KJ34Oz0r1Jtn2ihgJZmA7NrO5zATZVq6qQHdhry3xL1PpvY7U5Zx";
};
system.fsPackages = fsPkgs; system.fsPackages = fsPkgs;
environment.systemPackages = fsPkgs; environment.systemPackages = fsPkgs;
fileSystems."/data" = {
device = "//10.0.0.121/public";
fsType = "cifs";
options = [
"x-systemd.automount"
"noauto"
"x-systemd.idle-timeout=60"
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
"uid=1000"
"gid=1000"
"credentials=${builtins.toFile "creds.txt" ''
username=root
domain=WORKGROUP
''}"
];
};
/*
fileSystems = { fileSystems = {
"MergerFS Data" = { "MergerFS Data" = {
mountPoint = "/data"; mountPoint = "/data";
@ -46,74 +39,57 @@ in {
"3tb-1" = { "3tb-1" = {
mountPoint = "/mnt/drives/3tb1"; mountPoint = "/mnt/drives/3tb1";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N1236473-part1";
device = "matt@10.0.0.121:/drives/3tb-1";
# device = "/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N1236473-part1";
}; };
"3tb-2" = { "3tb-2" = {
mountPoint = "/mnt/drives/3tb2"; mountPoint = "/mnt/drives/3tb2";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N1233153-part1";
device = "matt@10.0.0.121:/drives/3tb-2";
# device = "/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N1233153-part1";
}; };
"4tb-1" = { "4tb-1" = {
mountPoint = "/mnt/drives/4tb1"; mountPoint = "/mnt/drives/4tb1";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD40EZAZ-19SF3B0_WD-WX32D81DE8RD-part1";
device = "matt@10.0.0.121:/drives/4tb-1";
# device = "/dev/disk/by-id/ata-WDC_WD40EZAZ-19SF3B0_WD-WX32D81DE8RD-part1";
}; };
"4tb-2" = { "4tb-2" = {
mountPoint = "/mnt/drives/4tb2"; mountPoint = "/mnt/drives/4tb2";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD40EZAZ-19SF3B0_WD-WX32D81DE6Z0-part1";
device = "matt@10.0.0.121:/drives/4tb-2";
# device = "/dev/disk/by-id/ata-WDC_WD40EZAZ-19SF3B0_WD-WX32D81DE6Z0-part1";
}; };
"8tb-1" = { "8tb-1" = {
mountPoint = "/mnt/drives/8tb1"; mountPoint = "/mnt/drives/8tb1";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD8003FFBX-68B9AN0_VAJ99UDL-part1";
device = "matt@10.0.0.121:/drives/8tb-1";
# device = "/dev/disk/by-id/ata-WDC_WD8003FFBX-68B9AN0_VAJ99UDL-part1";
}; };
"8tb-2 parity0" = { "8tb-2 parity0" = {
mountPoint = "/mnt/drives/parity0"; mountPoint = "/mnt/drives/parity0";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD8003FFBX-68B9AN0_VDGL4HZD-part1";
device = "matt@10.0.0.121:/drives/parity0";
# device = "/dev/disk/by-id/ata-WDC_WD8003FFBX-68B9AN0_VDGL4HZD-part1";
}; };
"8tb-3 parity1" = { "8tb-3 parity1" = {
mountPoint = "/mnt/drives/parity1"; mountPoint = "/mnt/drives/parity1";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD80EFZZ-68BTXN0_WD-CA13WUYK-part1";
device = "matt@10.0.0.121:/drives/parity1";
# device = "/dev/disk/by-id/ata-WDC_WD80EFZZ-68BTXN0_WD-CA13WUYK-part1";
}; };
"8tb-4" = { "8tb-4" = {
mountPoint = "/mnt/drives/8tb4"; mountPoint = "/mnt/drives/8tb4";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD80EAZZ-00BKLB0_WD-CA1AVU7K-part1";
device = "matt@10.0.0.121:/drives/8tb-4";
# device = "/dev/disk/by-id/ata-WDC_WD80EAZZ-00BKLB0_WD-CA1AVU7K-part1";
}; };
"8tb-5" = { "8tb-5" = {
mountPoint = "/mnt/drives/8tb5"; mountPoint = "/mnt/drives/8tb5";
fsType = "sshfs"; # "ext4"; fsType = "ext4";
options = sshfsOpts; device = "/dev/disk/by-id/ata-WDC_WD80EAZZ-00BKLB0_WD-CA1GN0GK-part1";
device = "matt@10.0.0.121:/drives/8tb-5";
# device = "/dev/disk/by-id/ata-WDC_WD80EAZZ-00BKLB0_WD-CA1GN0GK-part1";
}; };
}; };
*/
} }