NixOS/server/fstab.nix

270 lines
6.8 KiB
Nix

{ config, lib, pkgs, modulesPath, ... }: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
enable = true;
device = "nodev";
efiSupport = true;
enableCryptodisk = true;
};
};
initrd.luks.devices = {
nvme = {
device = "/dev/disk/by-uuid/af72f45c-cf7c-4e7d-8eab-2a95ab754921";
preLVM = true;
};
disk1 = {
device = "/dev/disk/by-uuid/a9b0f346-7e38-40a6-baf6-3ad80cafc842";
preLVM = true;
};
disk2 = {
device = "/dev/disk/by-uuid/0ed12b83-4c56-4ba8-b4ea-75a9e927d771";
preLVM = true;
};
hnbox = {
device = "/dev/disk/by-uuid/c7dd2d5a-b0b3-46a0-aca9-3d4975c1f0bc";
preLVM = true;
};
seedbox = {
device = "/dev/disk/by-uuid/04f06a3e-a91f-476b-9a4b-b9c722ba99e7";
preLVM = true;
};
};
kernelModules = [ "kvm-intel" ];
kernel.sysctl = {
"vm.swappiness" = 80;
"net.ipv6.conf.all.disable_ipv6" = 1;
"net.ipv6.conf.lo.disable_ipv6" = 1;
"net.ipv6.conf.default.disable_ipv6" = 1;
};
extraModulePackages = [ ];
initrd = {
availableKernelModules =
[ "xhci_pci" "ahci" "usbhid" "nvme" "usb_storage" "sd_mod" ];
kernelModules = [ ];
};
};
fileSystems = {
"/" = {
device = "/dev/mapper/nvme";
fsType = "btrfs";
options = [
"subvol=nix"
"ssd"
"compress=zstd:3"
"x-systemd.device-timeout=0"
"space_cache=v2"
"commit=120"
"datacow"
"noatime"
];
};
"/home" = {
device = "/dev/mapper/nvme";
fsType = "btrfs";
options = [
"subvol=home"
"ssd"
"compress=zstd:3"
"x-systemd.device-timeout=0"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/disks/disk1" = {
device = "/dev/mapper/disk1";
fsType = "btrfs";
options = [
"subvol=@data"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/disks/disk2" = {
device = "/dev/mapper/disk2";
fsType = "btrfs";
options = [
"subvol=@data"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/disks/seedbox" = {
device = "/dev/mapper/seedbox";
fsType = "btrfs";
options = [
"subvol=@data"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/disks/parity" = {
device = "/dev/disk/by-uuid/2e437a79-a246-411b-ac21-d03414b14305";
fsType = "ext4";
options = [ "defaults" ];
};
"/mnt/disks/hnbox" = {
device = "/dev/mapper/hnbox";
fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/c574cb53-dc40-46db-beff-0fe8a4787156";
fsType = "ext4";
};
"/boot/efi" = {
device = "/dev/disk/by-uuid/CBE7-5DEB";
fsType = "vfat";
};
"/mnt/pool" = {
device = "/mnt/disks/disk1:/mnt/disks/disk2";
fsType = "fuse.mergerfs";
options = [
"allow_other"
"noforget"
"func.getattr=newest"
"category.create=mfs"
"category.action=mfs"
"cache.files=partial"
"dropcacheonclose=true"
"inodecalc=path-hash"
"link_cow=true"
"nfsopenhack=all"
];
depends = [
"/mnt/disks/disk1"
"/mnt/disks/disk2"
"/mnt/disks/seedbox"
"/mnt/disks/parity"
"/mnt/disks/hnbox"
];
};
# NEXTCCLOUD
"/var/lib/nextcloud/data" = {
device = "/mnt/pool/nextcloud";
options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
# BTRFS SNAPER
"/mnt/btrfs/disk1" = {
device = "/dev/mapper/disk1";
fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
};
"/mnt/btrfs/disk2" = {
device = "/dev/mapper/disk2";
fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
};
"/mnt/btrfs/seedbox" = {
device = "/dev/mapper/seedbox";
fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
};
# snapraid content
"/mnt/snapraid/disk1" = {
device = "/dev/mapper/disk1";
fsType = "btrfs";
options = [
"subvol=@snapraid"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/snapraid/disk2" = {
device = "/dev/mapper/disk2";
fsType = "btrfs";
options = [
"subvol=@snapraid"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/snapraid/seedbox" = {
device = "/dev/mapper/seedbox";
fsType = "btrfs";
options = [
"subvol=@snapraid"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
# Jellyfin RO
"/mnt/jellyfin/external" = {
device = "/mnt/disks/seedbox/external";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
"/mnt/jellyfin/media" = {
device = "/mnt/pool/multimedia/media";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
"/mnt/jellyfin/tutorials" = {
device = "/mnt/pool/tutorials";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
"/mnt/jellyfin/workout" = {
device = "/mnt/disks/seedbox/other/P90x.Mega.Pack";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
# NFS
"/export/pool" = {
device = "/mnt/pool";
options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
"/export/jawz" = {
device = "/home/jawz";
options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
"/export/seedbox" = {
device = "/mnt/disks/seedbox";
options = [ "bind" ];
depends = [ "/mnt/disks/seedbox" ];
};
};
services.nfs = {
server = {
enable = true;
exports = ''
/export workstation(rw,fsid=0,no_subtree_check)
/export/jawz workstation(rw,nohide,insecure,no_subtree_check)
/export/seedbox workstation(rw,nohide,insecure,no_subtree_check)
/export/pool workstation(rw,nohide,insecure,no_subtree_check,async,no_root_squash,fsid=1)
'';
};
};
swapDevices = [{
device = "/dev/disk/by-partuuid/cb0ad486-ebf8-4bfc-ad7c-96bdc68576ca";
randomEncryption = {
enable = true;
cipher = "aes-xts-plain64";
keySize = 512;
sectorSize = 4096;
};
}];
}