dotfiles.nix/nixos/viridian/hardware-configuration.nix

98 lines
2.3 KiB
Nix
Raw Normal View History

2023-10-31 05:42:06 +08:00
{
2024-08-08 09:02:42 +08:00
config,
lib,
2024-08-11 16:15:30 +08:00
pkgs,
2024-08-08 09:02:42 +08:00
...
}: let
hostname = config.networking.hostName;
in {
2024-01-21 21:03:57 +08:00
imports = [
2024-08-11 16:15:30 +08:00
# Our ephemeral system. Wipe root on reboot.
2024-01-21 21:03:57 +08:00
../common/optional/ephemeral-btrfs.nix
];
2024-08-11 16:15:30 +08:00
# Boot configuration
2024-01-21 21:03:57 +08:00
boot = {
2024-08-11 16:15:30 +08:00
# Initial ramdisk
2024-01-21 21:03:57 +08:00
initrd = {
2024-08-11 16:15:30 +08:00
# The modules listed here are available in the initrd, but are only loaded on demand.
2024-08-08 09:02:42 +08:00
availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
2024-08-11 16:15:30 +08:00
# List of modules that are always loaded by the initrd.
2024-08-08 09:02:42 +08:00
kernelModules = ["kvm-intel"];
2023-10-31 05:42:06 +08:00
};
2024-08-11 16:15:30 +08:00
# Runtime parameters of the Linux kernel
kernel.sysctl = {
"net.ipv4.ip_unprivileged_port_start" = 0;
};
# Our boot loader configuration
2024-01-21 21:03:57 +08:00
loader = {
efi = {
efiSysMountPoint = "/boot";
2024-08-11 16:15:30 +08:00
canTouchEfiVariables = true;
2024-01-21 21:03:57 +08:00
};
2024-08-11 16:15:30 +08:00
systemd-boot.enable = true;
2023-10-31 05:42:06 +08:00
};
2024-01-21 21:03:57 +08:00
};
2023-10-31 05:42:06 +08:00
2024-08-11 16:15:30 +08:00
# Hardware configuration
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-compute-runtime
];
};
# Setup our filesystems
2024-08-08 09:02:42 +08:00
fileSystems."/boot" = {
2024-01-21 21:03:57 +08:00
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
2023-10-31 05:42:06 +08:00
2024-08-08 09:02:42 +08:00
fileSystems."/srv/multimedia" = {
2024-01-22 20:01:52 +08:00
device = "/dev/disk/by-label/multimedia";
2024-01-21 21:03:57 +08:00
fsType = "ext4";
};
2023-12-19 09:21:33 +08:00
2024-01-22 20:01:52 +08:00
fileSystems."/srv/containers" = {
2024-06-03 21:13:38 +08:00
device = "/dev/disk/by-label/${hostname}";
2024-01-22 20:01:52 +08:00
fsType = "btrfs";
2024-08-08 09:02:42 +08:00
options = ["subvol=containers" "compress=zstd"];
2024-01-22 20:01:52 +08:00
};
2024-06-03 21:13:38 +08:00
fileSystems."/srv/services" = {
device = "/dev/disk/by-label/${hostname}";
fsType = "btrfs";
2024-08-08 09:02:42 +08:00
options = ["subvol=services" "compress=zstd"];
2024-06-03 21:13:38 +08:00
};
2024-06-03 21:10:23 +08:00
fileSystems."/srv/shares" = {
device = "/dev/disk/by-label/data";
fsType = "btrfs";
2024-08-08 09:02:42 +08:00
options = ["subvol=shares" "compress=zstd"];
2024-06-03 21:10:23 +08:00
};
2024-01-22 20:01:52 +08:00
fileSystems."/srv/backup" = {
device = "/dev/disk/by-label/data";
fsType = "btrfs";
2024-08-08 09:02:42 +08:00
options = ["subvol=backup" "compress=zstd"];
2024-01-21 21:03:57 +08:00
};
2023-10-31 05:42:06 +08:00
2024-08-08 09:02:42 +08:00
swapDevices = [
{
device = "/swap/swapfile";
size = 16 * 1024;
2024-01-21 21:03:57 +08:00
}
];
2023-10-31 05:42:06 +08:00
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}