dotfiles/nixos/systems/omen/hardware.nix
magic_rb b71e57e8af
Disable specialisations for omen, makes eval too long
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-01-20 22:59:44 +01:00

137 lines
4.1 KiB
Nix

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
lib,
inputs',
options,
...
}: let
inherit
(lib)
singleton
mkForce
mapAttrs
mkOverride
filter
;
kernelPackages = pkgs.zfsUnstable.latestCompatibleLinuxPackages;
in {
environment.systemPackages = [
kernelPackages.turbostat
];
hardware.cpu.intel.updateMicrocode = true;
boot = {
initrd.systemd.enable = true;
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usb_storage"
"sr_mod"
"rtsx_pci_sdmmc"
"nvme"
"vmd"
];
initrd.kernelModules = [];
kernelModules = singleton "kvm-intel";
kernelParams = [
"zfs.zfs_arc_max=8589934592"
"zfs.zfs_arc_sys_free=3221225472"
"zfs.zfs_dmu_offset_next_sync=0"
# "intel_pstate=active"
"nvidia.NVreg_EnableS0ixPowerManagement=1"
"nvidia.NVreg_S0ixPowerManagementVideoMemoryThreshold=2048"
# "nvme.noacpi=1"
"nvme_core.default_ps_max_latency_us=30000"
];
kernelPackages = kernelPackages;
zfs.enableUnstable = true;
supportedFilesystems = singleton "zfs";
};
hardware.enableRedistributableFirmware = true;
hardware.nvidia.package = kernelPackages.nvidia_x11_beta;
hardware.tuxedo-keyboard.enable = true;
# specialisation.nvidia-sync.configuration = {
# environment.variables.NIXOS_SPECIALIZATION = "nvidia-sync";
# boot.loader.grub.enable = mkOverride 0 false;
# hardware.nvidia = {
# powerManagement.enable = mkForce false;
# powerManagement.finegrained = mkForce false;
# prime.offload.enableOffloadCmd = mkForce false;
# prime.offload.enable = mkForce false;
# prime.sync.enable = true;
# };
# };
# specialisation.nouveau.configuration = {
# environment.variables.NIXOS_SPECIALIZATION = "nouveau";
# boot.loader.grub.enable = mkOverride 0 false;
# hardware.nvidia = mapAttrs (_: v: mkForce v) {
# powerManagement.enable = false;
# powerManagement.finegrained = false;
# prime.offload.enableOffloadCmd = false;
# prime.offload.enable = false;
# nvidiaPersistenced = false;
# prime.reverseSync.enable = false;
# };
# services.xserver.videoDrivers = mkForce ["modesetting" "nouveau"];
# };
# specialisation.no-nvidia.configuration = {
# environment.variables.NIXOS_SPECIALIZATION = "no-nvidia";
# boot.loader.grub.enable = mkOverride 0 false;
# hardware.nvidia = mapAttrs (_: v: mkForce v) {
# powerManagement.enable = false;
# powerManagement.finegrained = false;
# prime.offload.enableOffloadCmd = false;
# prime.offload.enable = false;
# nvidiaPersistenced = false;
# prime.reverseSync.enable = false;
# };
# services.xserver.videoDrivers = mkForce ["modesetting"];
# boot.extraModprobeConfig = ''
# blacklist nouveau
# options nouveau modeset=0
# '';
# services.udev.extraRules = ''
# # Remove NVIDIA USB xHCI Host Controller devices, if present
# ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
# # Remove NVIDIA USB Type-C UCSI devices, if present
# ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
# # Remove NVIDIA Audio devices, if present
# ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
# # Remove NVIDIA VGA/3D controller devices
# ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
# '';
# boot.blacklistedKernelModules = ["nouveau" "nvidia" "nvidia_drm" "nvidia_modeset"];
# };
hardware.nvidia = {
nvidiaPersistenced = true;
powerManagement.enable = true;
powerManagement.finegrained = true;
prime.reverseSync.enable = false;
prime.offload.enable = true;
modesetting.enable = true;
};
}