dotfiles/nixos/systems/omen/hardware.nix

101 lines
2.3 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
lib,
inputs',
options,
config,
...
}: let
inherit
(lib)
singleton
mkForce
mapAttrs
mkOverride
filter
;
kernelPackages = pkgs.linuxPackages_6_6;
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;
hardware.nvidia = {
nvidiaPersistenced = true;
powerManagement.enable = true;
powerManagement.finegrained = true;
prime.reverseSync.enable = false;
prime.offload.enable = true;
modesetting.enable = true;
};
specialisation.nouveau.configuration = {
environment.variables.NIXOS_SPECIALIZATION = "nouveau";
boot.loader.grub.enable = mkOverride 0 false;
boot.kernelPackages = mkForce config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.kernelParams = [
"nouveau.config=NvGspRm=1"
];
imports = [
inputs'.chaotic-nyx.nixosModules.default
];
chaotic.mesa-git.enable = true;
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"];
};
}