Files
nixos/hosts/nas/hardware-configuration.nix

93 lines
2.1 KiB
Nix

# Hardware configuration for NAS
# TODO: Update disk labels/UUIDs after installation
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.loader.systemd-boot = {
enable = true;
configurationLimit = 5;
};
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# RAID 1 array for data storage
boot.swraid = {
enable = true;
mdadmConf = ''
DEVICE /dev/disk/by-id/ata-ST18000NM000J-2TV103_ZR52TBSB-part1
DEVICE /dev/disk/by-id/ata-ST18000NM000J-2TV103_ZR52V9QX-part1
'';
};
# Tmpfs root filesystem (ephemeral - resets on reboot)
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [ "size=8G" "mode=755" ];
};
# Boot partition - EFI
fileSystems."/boot" = {
device = "/dev/disk/by-partlabel/BOOT";
fsType = "vfat";
};
fileSystems."/nix" = {
device = "/dev/disk/by-partlabel/NIXOS";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@"
"compress=zstd:1"
"noatime"
"commit=120"
];
};
fileSystems."/nix/store" = {
device = "/dev/disk/by-partlabel/NIXOS";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@nix-store"
"compress=zstd:1"
"noatime"
"commit=120"
];
};
fileSystems."/nix/persist" = {
device = "/dev/disk/by-partlabel/NIXOS";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@nix-persist"
"compress=zstd:1"
"noatime"
"commit=120"
];
};
# LVM volumes on RAID array
fileSystems."/var/lib/downloads" = {
device = "/dev/vg-data/lv-downloads";
fsType = "xfs";
};
fileSystems."/var/lib/multimedia" = {
device = "/dev/vg-data/lv-multimedia";
fsType = "xfs";
};
# DHCP networking
networking.useDHCP = lib.mkDefault true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}