adyya-flake/hardware.mod.nix

154 lines
4.1 KiB
Nix

{ nixos-hardware, ... }:
let
config = name: system: additional: {
inherit name;
value = {
inherit system;
modules = [
{
networking.hostName = name;
nixpkgs.hostPlatform = system;
}
] ++ additional;
};
};
filesystem = fsType: path: device: options: {
fileSystems.${path} = {
inherit device fsType;
} // (if options == null then { } else { inherit options; });
};
fs.mergerfs = filesystem "fuse.mergerfs";
fs.btrfs = filesystem "btrfs";
fs.ext4 = filesystem "ext4";
fs.vfat = filesystem "vfat";
swap = device: { swapDevices = [ { inherit device; } ]; };
cpu = brand: { hardware.cpu.${brand}.updateMicrocode = true; };
qemu =
{ modulesPath, ... }:
{
imports = [ "${modulesPath}/profiles/qemu-guest.nix" ];
};
in
{
universal.modules = [
(
{
pkgs,
lib,
...
}:
{
environment.systemPackages = with pkgs; [ mergerfs ];
hardware.enableRedistributableFirmware = true;
boot.kernelPackages = pkgs.linuxPackages_latest; # hope this doesn't break anything -e
networking.useDHCP = lib.mkDefault true;
}
)
];
personal.modules = [
{
services.fwupd.enable = true;
}
];
}
// builtins.listToAttrs [
(config "capsaicin" "x86_64-linux" [
(cpu "intel")
(fs.btrfs "/" "/dev/disk/by-uuid/a1a32f8b-847c-4349-8743-05d25950db1d" null)
(fs.btrfs "/mnt/hdd1tb" "/dev/disk/by-uuid/1b1451cd-89ce-4daa-afdb-37ceecbb9484" null)
(fs.ext4 "/mnt/hdd500gb" "/dev/disk/by-uuid/d7a35003-4b60-4a5e-b87a-af7c18eefe04" null)
(fs.vfat "/boot" "/dev/disk/by-uuid/5C2E-B6F1" null)
(swap "/dev/disk/by-uuid/16f09a9c-74ef-4a32-b9c0-d3948d76f3a0")
{
boot.loader.systemd-boot.enable = true;
zramSwap.enable = true;
boot.initrd.kernelModules = [ ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"sd_mod"
];
boot.kernelModules = [
"usbmon"
"v4l2loopback"
];
boot.extraModulePackages = [ ];
}
])
(config "menthol" "x86_64-linux" [
(cpu "intel")
(fs.btrfs "/" "/dev/disk/by-uuid/1a254d99-6480-4557-b3e8-e8ee745f5832" null)
(swap "/dev/disk/by-uuid/455a7c78-fdc3-4dbb-b9f2-9518d960191b")
{
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.initrd.kernelModules = [ ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
}
])
(config "glucose" "x86_64-linux" [
(cpu "intel")
(fs.btrfs "/" "/dev/disk/by-uuid/abbb549e-19b4-4855-b3c7-0b81ab784b74" null)
(swap "/dev/disk/by-uuid/dc948ee6-94fb-49b2-94d4-317aa41f1a9d")
{
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.initrd.kernelModules = [ ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"sd_mod"
];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
}
])
(config "fructose" "x86_64-linux" [
(cpu "intel")
(fs.btrfs "/" "/dev/disk/by-uuid/e1b611e6-485f-4c2e-81fa-2fbcb3a7f1ba" null)
(swap "/dev/disk/by-uuid/83c561a1-08b9-4b48-bdfc-102098fd2059")
{
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.initrd.kernelModules = [ ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"sd_mod"
];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
}
])
(config "aspartame" "x86_64-linux" [
qemu
(fs.ext4 "/" "/dev/disk/by-uuid/2def7bee-b1e3-49ea-b46c-33f272aaa5b2" null)
{
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
}
])
]