2024-09-23 16:22:01 -04:00
|
|
|
{ config, lib, pkgs, outputs, modulesPath, ... }: let
|
2024-08-24 22:16:51 -04:00
|
|
|
# Set common boot paramaters
|
|
|
|
commonKernelParams = [
|
|
|
|
# Nvidia settings
|
|
|
|
"nvidia_drm.fbdev=1"
|
2024-08-29 14:15:26 -04:00
|
|
|
"nouveau.config=NvGspRm=1"
|
2024-08-24 22:16:51 -04:00
|
|
|
|
|
|
|
# VM/GPU passthrough
|
|
|
|
"amd_iommu=on"
|
|
|
|
"iommu=pt"
|
|
|
|
"nested=1"
|
|
|
|
|
|
|
|
# Virtualization nonsense
|
|
|
|
"transparent_hugepage=never"
|
|
|
|
|
|
|
|
# Isolate devices into IOMMU groups
|
|
|
|
"pcie_acs_override=downstream,multifunction"
|
|
|
|
"pci=routeirq"
|
|
|
|
];
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
(modulesPath + "/installer/scan/not-detected.nix")
|
|
|
|
];
|
|
|
|
|
|
|
|
# Set all boot options
|
|
|
|
boot = {
|
|
|
|
# Set a kernel version and load/blacklist drivers
|
|
|
|
kernelPackages = pkgs.unstable.linuxPackages_zen;
|
|
|
|
blacklistedKernelModules = [
|
|
|
|
"pcspkr"
|
|
|
|
];
|
|
|
|
kernel.sysctl."vm.max_map_count" = 2147483642;
|
|
|
|
kernelParams = commonKernelParams ++ [
|
|
|
|
"vfio-pci.ids=10de:1f82,10de:10fa"
|
|
|
|
];
|
|
|
|
initrd = {
|
|
|
|
availableKernelModules = [
|
|
|
|
"nvme"
|
|
|
|
"xhci_pci"
|
|
|
|
"ahci"
|
|
|
|
"usbhid"
|
|
|
|
"usb_storage"
|
|
|
|
"sd_mod"
|
|
|
|
];
|
|
|
|
kernelModules = [
|
|
|
|
"vfio"
|
|
|
|
"vfio_pci"
|
|
|
|
"vfio_iommu_type1"
|
|
|
|
"kvm-amd"
|
|
|
|
];
|
2024-10-07 15:11:45 -04:00
|
|
|
luks.devices = {
|
|
|
|
"crypt-ssd" = {
|
|
|
|
device = "/dev/disk/by-uuid/52110c74-19b6-40ef-9710-e6c9b157005f";
|
|
|
|
preLVM = true;
|
|
|
|
allowDiscards = true;
|
|
|
|
};
|
|
|
|
};
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Additional entry to boot from the second GPU
|
|
|
|
specialisation = {
|
|
|
|
gputwo.configuration = {
|
|
|
|
boot.kernelParams = commonKernelParams ++ ["vfio-pci.ids=10de:2504,10de:228e"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Mount everything as necessary
|
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
2024-10-07 15:11:45 -04:00
|
|
|
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=@" "noatime" "nodiratime" "discard" ];
|
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=@home" "noatime" "nodiratime" "discard" ];
|
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=@nix" "noatime" "nodiratime" "discard" ];
|
|
|
|
};
|
|
|
|
"/var" = {
|
|
|
|
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=@var" "noatime" "nodiratime" "discard" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/boot" = {
|
2024-10-07 15:11:45 -04:00
|
|
|
device = "/dev/disk/by-uuid/3B4A-76C9";
|
2024-08-24 22:16:51 -04:00
|
|
|
fsType = "vfat";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "fmask=0022" "dmask=0022" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/etc/libvirt" = {
|
|
|
|
device = "/dev/disk/by-label/Qemu";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "nosuid" "nodev" "nofail" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/var/lib/libvirt" = {
|
2024-10-07 15:11:45 -04:00
|
|
|
depends = [ "/etc/libvirt" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
device = "/etc/libvirt/varlibvirt";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "bind" "rw" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/mnt/Linux1" = {
|
|
|
|
device = "/dev/disk/by-label/Linux1";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/mnt/Linux2" = {
|
|
|
|
device = "/dev/disk/by-label/Linux2";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/mnt/Windows1" = {
|
|
|
|
device = "/dev/disk/by-label/Windows1";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "nosuid" "nodev" "noauto" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/mnt/Windows2" = {
|
|
|
|
device = "/dev/disk/by-label/Windows2";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "nosuid" "nodev" "noauto" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
"/home/jimbo/JimboNFS" = {
|
2024-09-23 16:22:01 -04:00
|
|
|
device = "${outputs.ips.server}:/export/JimboNFS";
|
2024-08-24 22:16:51 -04:00
|
|
|
fsType = "nfs4";
|
2024-10-07 15:11:45 -04:00
|
|
|
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set the swap partition
|
|
|
|
swapDevices = [
|
2024-10-07 15:11:45 -04:00
|
|
|
{ device = "/dev/disk/by-uuid/1a6a68d0-8ae7-4836-a585-b708597937a1"; }
|
2024-08-24 22:16:51 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
# Enables DHCP on each ethernet and wireless interface.
|
|
|
|
networking.useDHCP = lib.mkDefault true;
|
|
|
|
|
|
|
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
|
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
|
|
}
|