refactor: Move network share mount to module
This commit is contained in:
parent
b09f6105d2
commit
fd59db025f
3 changed files with 91 additions and 75 deletions
26
os-mods/net_disks/oeko.nix
Normal file
26
os-mods/net_disks/oeko.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
inputs.nixos-hardware.nixosModules.common-hidpi
|
||||
inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call
|
||||
inputs.nixos-hardware.nixosModules.framework-16-7040-amd
|
||||
../../os-mods/net_disks/oeko.nix
|
||||
../../os-mods/amdgpu
|
||||
../../os-mods/cachix
|
||||
../../os-mods/common
|
||||
|
|
|
@ -14,82 +14,71 @@
|
|||
# --label=ssd.ssd_4t /dev/mapper/crypt_ssd_4t_data \
|
||||
# --label=ssd.ssd_2t /dev/mapper/crypt_ssd_2t_data
|
||||
|
||||
boot = {
|
||||
supportedFilesystems = [ "bcachefs" "vfat" ];
|
||||
initrd.supportedFilesystems = [ "bcachefs" "vfat" ];
|
||||
initrd.luks.devices =
|
||||
lib.attrsets.mergeAttrsList
|
||||
(
|
||||
lib.lists.forEach [
|
||||
"crypt_ssd_4t_data"
|
||||
"crypt_ssd_4t_swap"
|
||||
"crypt_ssd_2t_data"
|
||||
"crypt_ssd_2t_swap"
|
||||
]
|
||||
(drive: {
|
||||
"${drive}" = {
|
||||
device = "/dev/disk/by-partlabel/${drive}";
|
||||
allowDiscards = true;
|
||||
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;
|
||||
# };
|
||||
config = {
|
||||
boot = {
|
||||
supportedFilesystems = [ "bcachefs" "vfat" ];
|
||||
initrd.supportedFilesystems = [ "bcachefs" "vfat" ];
|
||||
initrd.luks.devices =
|
||||
lib.attrsets.mergeAttrsList
|
||||
(
|
||||
lib.lists.forEach [
|
||||
"crypt_ssd_4t_data"
|
||||
"crypt_ssd_4t_swap"
|
||||
"crypt_ssd_2t_data"
|
||||
"crypt_ssd_2t_swap"
|
||||
]
|
||||
(drive: {
|
||||
"${drive}" = {
|
||||
device = "/dev/disk/by-partlabel/${drive}";
|
||||
allowDiscards = true;
|
||||
bypassWorkqueues = true;
|
||||
# crypttabExtraOpts = [ "nofail" ];
|
||||
};
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{ device = "/dev/disk/by-uuid/a8f478f0-ad5e-47ae-8e18-63060f7e5706"; }
|
||||
{ device = "/dev/disk/by-uuid/59987b2a-c5c5-4547-95ad-f0d1dcdf8458"; }
|
||||
];
|
||||
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" ];
|
||||
};
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue