refactor: Move network share mount to module

This commit is contained in:
Tristan D. 2024-10-15 00:18:35 +02:00
parent b09f6105d2
commit fd59db025f
Signed by: tristan
SSH key fingerprint: SHA256:9oFM1J63hYWJjCnLG6C0fxBS15rwNcWwdQNMOHYKJ/4
3 changed files with 91 additions and 75 deletions

View file

@ -0,0 +1,26 @@
{
fileSystems =
let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
perm_opts = "uid=1001,gid=100";
smb_opts = [
"vers=2.0,credentials=/home/tristand/.smb-secrets"
perm_opts
automount_opts
];
in
{
"/mnt/ServerF" = {
# device = "//srv-nas-01.local/Server_F";
device = "//192.168.0.1/Server_F";
fsType = "cifs";
options = smb_opts;
};
"/mnt/Scans" = {
# device = "//srv-nas-01.local/Server_F";
device = "//192.168.0.1/Scans";
fsType = "cifs";
options = smb_opts;
};
};
}

View file

@ -11,6 +11,7 @@
inputs.nixos-hardware.nixosModules.common-hidpi inputs.nixos-hardware.nixosModules.common-hidpi
inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call
inputs.nixos-hardware.nixosModules.framework-16-7040-amd inputs.nixos-hardware.nixosModules.framework-16-7040-amd
../../os-mods/net_disks/oeko.nix
../../os-mods/amdgpu ../../os-mods/amdgpu
../../os-mods/cachix ../../os-mods/cachix
../../os-mods/common ../../os-mods/common

View file

@ -14,82 +14,71 @@
# --label=ssd.ssd_4t /dev/mapper/crypt_ssd_4t_data \ # --label=ssd.ssd_4t /dev/mapper/crypt_ssd_4t_data \
# --label=ssd.ssd_2t /dev/mapper/crypt_ssd_2t_data # --label=ssd.ssd_2t /dev/mapper/crypt_ssd_2t_data
boot = { config = {
supportedFilesystems = [ "bcachefs" "vfat" ]; boot = {
initrd.supportedFilesystems = [ "bcachefs" "vfat" ]; supportedFilesystems = [ "bcachefs" "vfat" ];
initrd.luks.devices = initrd.supportedFilesystems = [ "bcachefs" "vfat" ];
lib.attrsets.mergeAttrsList initrd.luks.devices =
( lib.attrsets.mergeAttrsList
lib.lists.forEach [ (
"crypt_ssd_4t_data" lib.lists.forEach [
"crypt_ssd_4t_swap" "crypt_ssd_4t_data"
"crypt_ssd_2t_data" "crypt_ssd_4t_swap"
"crypt_ssd_2t_swap" "crypt_ssd_2t_data"
] "crypt_ssd_2t_swap"
(drive: { ]
"${drive}" = { (drive: {
device = "/dev/disk/by-partlabel/${drive}"; "${drive}" = {
allowDiscards = true; device = "/dev/disk/by-partlabel/${drive}";
bypassWorkqueues = true; allowDiscards = true;
# crypttabExtraOpts = [ "nofail" ]; bypassWorkqueues = true;
}; # crypttabExtraOpts = [ "nofail" ];
}) };
); })
}; );
fileSystems =
let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
perm_opts = "uid=1001,gid=100";
smb_opts = [
"vers=2.0,credentials=/home/tristand/.smb-secrets"
perm_opts
automount_opts
];
sshfs_opts = [
"allow_other,_netdev,reconnect,ServerAliveInterval=15,IdentityFile=/var/secrets/id_ed25519"
perm_opts
automount_opts
];
in
{
"/" = {
device = "/dev/mapper/crypt_ssd_4t_data";
# device = "UUID=f89215ba-3313-42d3-8f68-051ad2453870";
fsType = "bcachefs";
options = [ "relatime" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/05A2-6A8A";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
"/mnt/ServerF" = {
# device = "//srv-nas-01.local/Server_F";
device = "//192.168.0.1/Server_F";
fsType = "cifs";
options = smb_opts;
};
"/mnt/Scans" = {
# device = "//srv-nas-01.local/Server_F";
device = "//192.168.0.1/Scans";
fsType = "cifs";
options = smb_opts;
};
# "/mnt/media_v2" = {
# device = "root@23.88.68.113:/media_v2";
# fsType = "sshfs";
# options = sshfs_opts;
# };
}; };
swapDevices = [ fileSystems =
{ device = "/dev/disk/by-uuid/a8f478f0-ad5e-47ae-8e18-63060f7e5706"; } let
{ device = "/dev/disk/by-uuid/59987b2a-c5c5-4547-95ad-f0d1dcdf8458"; } automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
]; perm_opts = "uid=1001,gid=100";
smb_opts = [
"vers=2.0,credentials=/home/tristand/.smb-secrets"
perm_opts
automount_opts
];
sshfs_opts = [
"allow_other,_netdev,reconnect,ServerAliveInterval=15,IdentityFile=/var/secrets/id_ed25519"
perm_opts
automount_opts
];
in
{
"/" = {
device = "/dev/mapper/crypt_ssd_4t_data";
# device = "UUID=f89215ba-3313-42d3-8f68-051ad2453870";
fsType = "bcachefs";
options = [ "relatime" ];
};
system.fsPackages = [ pkgs.sshfs ]; "/boot" = {
device = "/dev/disk/by-uuid/05A2-6A8A";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
# "/mnt/media_v2" = {
# device = "root@23.88.68.113:/media_v2";
# fsType = "sshfs";
# options = sshfs_opts;
# };
};
swapDevices = [
{ device = "/dev/disk/by-uuid/a8f478f0-ad5e-47ae-8e18-63060f7e5706"; }
{ device = "/dev/disk/by-uuid/59987b2a-c5c5-4547-95ad-f0d1dcdf8458"; }
];
system.fsPackages = [ pkgs.sshfs ];
};
} }