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

84 lines
1.9 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
...
2024-10-15 06:46:10 +08:00
}: {
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-10-16 04:59:59 +08:00
fileSystems."/srv/multimedia/containers" = {
device = "/dev/disk/by-label/data";
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-10-01 17:35:42 +08:00
fileSystems."/srv/shares" = {
device = "/dev/disk/by-label/data";
fsType = "btrfs";
options = ["subvol=shares" "compress=zstd"];
};
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;
}