nixos-config/machines/hitagi/hardware-configuration.nix
Simon Bruder f4efa9b1fc
hitagi: Switch to Intel Arc A770
Things are not very smooth yet. Hwmon only works with Kernel 6.2 and
only supports energy monitoring (and even that doesn’t look too good).
Fan control and temperature is not supported. To get at least usage
statistics, intel_gpu_top can be used. Mangohud in its newest unreleased
version also supports getting stats from it. However, intel_gpu_top
needs cap_perfmon, which is a pain to get working inside the double
bubblewrap sandbox for steam, therefore it is not yet available.

On the positive side, OpenCL works well and oneAPI also works with
blender-bin from nix-warez (nixpkgs doesn’t yet have blender with oneAPI
support).
2023-02-11 22:53:54 +01:00

175 lines
4.6 KiB
Nix

{ config, lib, modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
# Intel arc
#kernelPackages = pkgs.linuxPackages_latest;
kernelPackages = pkgs.unstable.recurseIntoAttrs (pkgs.unstable.linuxPackagesFor (pkgs.unstable.callPackage
({ fetchurl, buildLinux, ... } @ args: buildLinux (args // rec {
version = "6.2.0-rc7";
modDirVersion = version;
src = fetchurl {
url = "https://git.kernel.org/torvalds/t/linux-6.2-rc7.tar.gz";
sha256 = "sha256-6klAGw+J0usyY55dTMb/reUbAobJdheG/6YvNGz7SwM=";
};
kernelPatches = [ ];
extraMeta.branch = "6.2";
} // (args.argsOverride or { })))
{ }));
# fan control configuration from https://gist.github.com/bakman2/e801f342aaa7cade62d7bd54fd3eabd8
kernelModules = [ "kvm-amd" "it87" ];
kernelParams = [ "acpi_enforce_resources=lax" ]; # allow it87 to load
extraModulePackages = with config.boot.kernelPackages; [ it87 ];
extraModprobeConfig = ''
options it87 force_id=0x8688
'';
loader = {
grub.enable = false;
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "ehci_pci" "nvme" "sd_mod" "sr_mod" "usb_storage" "usbhid" "xhci_pci" ];
kernelModules = [ "dm-snapshot" ];
luks.devices = {
root = {
name = "root";
device = "/dev/disk/by-uuid/1607bb2a-329b-4252-b11a-b43eb6b7bf0c";
preLVM = true;
allowDiscards = true;
};
};
};
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/9e6b279e-6995-44da-b673-21b9e23a5278";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/75DA-DFE2";
fsType = "vfat";
};
"/data" = {
device = "/dev/mapper/data";
fsType = "btrfs";
options = [ "compress=zstd" ];
encrypted = {
label = "data";
enable = true;
blkDev = "/dev/disk/by-uuid/7f4ba71e-3aca-4294-b37f-49f37b584dbd";
keyFile = "/mnt-root/root/luks-data";
};
};
"/data/ssd" = {
device = "/dev/mapper/data-ssd";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
encrypted = {
# !!! HACK
label = "data-ssd --allow-discards";
enable = true;
blkDev = "/dev/disk/by-uuid/41baa168-7fa0-4eb3-b314-50766ddf126d";
keyFile = "/mnt-root/root/luks-data";
};
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/2774d182-ddc9-4d79-886e-995fcd60a88a"; }
];
# GPU
hardware.opengl = {
package = pkgs.unstable.mesa.drivers;
package32 = pkgs.unstable.pkgsi686Linux.mesa.drivers;
extraPackages = with pkgs; [
intel-media-driver
libvdpau-va-gl
vaapiIntel
vaapiVdpau
] ++ (with pkgs.unstable; [
intel-compute-runtime
intel-compute-runtime.drivers
level-zero
]);
};
environment.systemPackages = with pkgs; [
clinfo
nvtop-amd # also returns basic stats for intel
];
security.wrappers."intel_gpu_top" = {
owner = "root";
group = "root";
capabilities = "cap_perfmon+p";
source = "${pkgs.unstable.intel-gpu-tools}/bin/intel_gpu_top";
};
# https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
systemd.services.suspend-fix = {
wantedBy = [ "multi-user.target" ];
description = "Fix suspend";
script = ''
if grep -q "GPP0 .* \*enabled" /proc/acpi/wakeup; then
echo GPP0 > /proc/acpi/wakeup
echo "Disabled wakeup for GPP0"
else
echo "Wakeup for GPP0 already disabled"
fi
'';
serviceConfig = {
Type = "oneshot";
};
};
sbruder.fancontrol = {
enable = false; # no hwmon for intel arc (yet)
enableDefaultMapping = true;
fans = {
front = {
pwmFile = "/sys/class/hwmon/hwmon1/pwm4";
rpmFile = "/sys/class/hwmon/hwmon1/fan4_input";
pwmLineStart = 50;
neverStop = true;
};
back = {
pwmFile = "/sys/class/hwmon/hwmon1/pwm2";
rpmFile = "/sys/class/hwmon/hwmon1/fan2_input";
};
};
sensors = {
cpu = {
file = "/sys/class/hwmon/hwmon2/temp3_input";
min = 50;
max = 80;
};
gpu = {
file = "/sys/class/hwmon/hwmon4/temp1_input";
min = 50;
max = 70;
};
nvme = {
file = "/sys/class/hwmon/hwmon0/temp1_input";
min = 40;
max = 70;
};
};
};
}