dotfiles/nixos/systems/omen/hardware.nix

142 lines
3.4 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.linuxKernel.packages.linux_6_6;
in {
environment.systemPackages = [
kernelPackages.turbostat
];
environment.variables.NOUVEAU_USE_ZINK = "1";
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 = [
"dm_crypt"
"encrypted_keys"
"trusted"
"nhpoly1305_avx2"
"nhpoly1305_sse2"
"nhpoly1305"
"crypto_null"
"polyval_clmulni"
"polyval_generic"
"gf128mul"
"dm_mod"
"crypto_simd"
"cryptd"
"adiantum"
"libpoly1305"
"libchacha20poly1305"
"chacha_x86_64"
"libchacha"
"poly1305_x86_64"
];
extraModulePackages = [
(config.boot.kernelPackages.tuxedo-keyboard.overrideAttrs (
final: prev: {
version = "v4.8.0";
src = pkgs.fetchFromGitLab {
owner = "tuxedocomputers/development/packages";
repo = "tuxedo-drivers";
rev = final.version;
hash = "sha256-MN3p51Y9yqHc69BK8Wu8NtW18DdRIyxEYjH+Tqn/SXk=";
};
installPhase = ''
runHook preInstall
mkdir -p "$out/lib/modules/${config.boot.kernelPackages.kernel.modDirVersion}"
for module in $(find . -name '*.ko'); do
mv $module $out/lib/modules/${config.boot.kernelPackages.kernel.modDirVersion}
done
runHook postInstall
'';
}
))
];
kernelModules = [
"kvm-intel"
"tuxedo_keyboard"
];
kernelParams = [
"zfs.zfs_arc_max=8589934592"
"zfs.zfs_arc_sys_free=3221225472"
"nouveau.config=NvGspRm=1"
];
kernelPackages = kernelPackages;
};
hardware.enableRedistributableFirmware = true;
chaotic.mesa-git = {
enable = true;
fallbackSpecialisation = false;
};
specialisation.nvidia.configuration = {config, ...}: {
environment.variables.NIXOS_SPECIALISATION = "nvidia";
boot.loader.grub.enable = mkOverride 0 false;
boot.kernelPackages = mkForce pkgs.linuxPackages_6_6;
boot.kernelParams = [
"nvidia.NVreg_EnableS0ixPowerManagement=1"
"nvidia.NVreg_S0ixPowerManagementVideoMemoryThreshold=2048"
];
chaotic.mesa-git.enable = mkForce false;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "565.57.01";
sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo=";
sha256_aarch64 = "";
openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA=";
settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA=";
persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg=";
};
hardware.nvidia = {
open = true;
nvidiaPersistenced = true;
powerManagement.enable = true;
powerManagement.finegrained = true;
prime.reverseSync.enable = false;
prime.offload.enable = true;
modesetting.enable = true;
};
services.xserver.videoDrivers = mkForce ["nvidia"];
};
}