dotfiles/nixos/systems/omen/hardware.nix
Magic_RB 519d7b3841
Fill out omen, toothpick and heater
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-06-16 16:08:01 +02:00

110 lines
3.1 KiB
Nix

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{ pkgs, lib, inputs', ... }:
let
inherit (lib)
singleton
mkForce;
kernelPackages =
pkgs.linuxKernel.packages.linux_xanmod_latest.extend (final: prev:
{
zfsUnstable =
let
unstableNix =
{ callPackage
, kernel ? null
, stdenv
, linuxKernel
, ...
} @ args:
let
stdenv' = if kernel == null then stdenv else kernel.stdenv;
in
callPackage "${inputs'.nixpkgs}/pkgs/os-specific/linux/zfs/generic.nix" args {
# check the release notes for compatible kernels
# NOTE:
# zfs-2.1.9<=x<=2.1.10 is broken with aarch64-linux-6.2
# for future releases, please delete this condition.
kernelCompatible = kernel.kernelOlder "6.4";
latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_3;
# this package should point to a version / git revision compatible with the latest kernel release
# IMPORTANT: Always use a tagged release candidate or commits from the
# zfs-<version>-staging branch, because this is tested by the OpenZFS
# maintainers.
version = "zfs-2.1.12";
rev = "86783d7d92cf7a859464719a917fdff845b9a9e1";
sha256 = "sha256-eYUR5d4gpTrlFu6j1uL83DWL9uPGgAUDRdSEb73V5i4=";
isUnstable = true;
};
in
prev.callPackage unstableNix {
configFile = "kernel";
};
}
);
in
{
environment.systemPackages = [
kernelPackages.turbostat
];
hardware.cpu.intel.updateMicrocode = true;
boot = {
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"
# "intel_pstate=active"
"nvidia.NVreg_EnableS0ixPowerManagement=1"
"nvidia.NVreg_S0ixPowerManagementVideoMemoryThreshold=2048"
# "nvme.noacpi=1"
"nvme_core.default_ps_max_latency_us=30000"
];
kernelPackages = kernelPackages;
kernelPatches = [
{
name = "nvme-kingston-sleep";
patch = ./0001-Revert-nvme-pci-avoid-the-deepest-sleep-state-on-Kin.patch;
}
];
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 = true;
prime.offload.enable = true;
modesetting.enable = true;
};
}