84 lines
2.3 KiB
Nix
84 lines
2.3 KiB
Nix
{ config
|
|
, lib
|
|
, pkgs
|
|
, modulesPath
|
|
, system
|
|
, inputs
|
|
, ...
|
|
}: {
|
|
# bcachefs format \
|
|
# --metadata_replicas=2 \
|
|
# --data_replicas=1 \
|
|
# --background_compression=zstd \
|
|
# --discard \
|
|
# --label=ssd.ssd_4t /dev/mapper/crypt_ssd_4t_data \
|
|
# --label=ssd.ssd_2t /dev/mapper/crypt_ssd_2t_data
|
|
|
|
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" ];
|
|
};
|
|
})
|
|
);
|
|
};
|
|
|
|
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=3,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/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 ];
|
|
};
|
|
}
|