2024-05-25 16:13:03 +02:00
|
|
|
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
|
2024-01-06 01:19:35 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2020-12-06 10:53:40 +01:00
|
|
|
{ config, lib, modulesPath, pkgs, ... }:
|
2020-10-17 23:18:22 +02:00
|
|
|
|
|
|
|
{
|
2020-12-06 10:53:40 +01:00
|
|
|
imports = [
|
|
|
|
(modulesPath + "/installer/scan/not-detected.nix")
|
|
|
|
];
|
2020-10-17 23:18:22 +02:00
|
|
|
|
2020-12-06 10:53:40 +01:00
|
|
|
boot = {
|
2023-02-11 22:53:54 +01:00
|
|
|
# Intel arc
|
2023-03-09 21:18:22 +01:00
|
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
2023-01-22 16:35:02 +01:00
|
|
|
# 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
|
|
|
|
'';
|
2022-05-07 12:34:25 +02:00
|
|
|
loader = {
|
|
|
|
grub.enable = false;
|
|
|
|
systemd-boot.enable = true;
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
};
|
2020-12-06 10:53:40 +01:00
|
|
|
initrd = {
|
2021-05-04 23:15:05 +02:00
|
|
|
availableKernelModules = [ "aesni_intel" "ahci" "ehci_pci" "nvme" "sd_mod" "sr_mod" "usb_storage" "usbhid" "xhci_pci" ];
|
2022-10-15 23:27:12 +02:00
|
|
|
kernelModules = [ "dm-snapshot" ];
|
2020-12-06 11:03:23 +01:00
|
|
|
luks.devices = {
|
|
|
|
root = {
|
|
|
|
name = "root";
|
2023-05-24 16:27:39 +02:00
|
|
|
device = "/dev/disk/by-uuid/63c6aa7c-47c5-43f5-b0eb-c32b0768327b";
|
2020-12-06 11:03:23 +01:00
|
|
|
preLVM = true;
|
|
|
|
allowDiscards = true;
|
|
|
|
};
|
|
|
|
};
|
2020-12-06 10:53:40 +01:00
|
|
|
};
|
|
|
|
};
|
2020-10-17 23:18:22 +02:00
|
|
|
|
2020-12-06 10:53:40 +01:00
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
2023-05-24 16:27:39 +02:00
|
|
|
device = "/dev/disk/by-uuid/3994f497-9848-459e-9642-cbc14a7d3c97";
|
2021-05-04 23:15:05 +02:00
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "discard=async" "noatime" "compress=zstd" ];
|
2020-10-17 23:18:22 +02:00
|
|
|
};
|
|
|
|
|
2020-12-06 10:53:40 +01:00
|
|
|
"/boot" = {
|
2023-05-24 16:27:39 +02:00
|
|
|
device = "/dev/disk/by-uuid/96B6-34BD";
|
2022-05-07 12:34:25 +02:00
|
|
|
fsType = "vfat";
|
2020-10-17 23:18:22 +02:00
|
|
|
};
|
2020-12-06 10:53:40 +01:00
|
|
|
};
|
2020-10-17 23:18:22 +02:00
|
|
|
|
2020-12-06 10:53:40 +01:00
|
|
|
swapDevices = [
|
2023-05-24 16:27:39 +02:00
|
|
|
{ device = "/dev/disk/by-uuid/98de7ced-4d7c-4915-bf5b-1a0300458ea6"; }
|
2020-12-06 10:53:40 +01:00
|
|
|
];
|
2020-10-17 23:18:22 +02:00
|
|
|
|
2024-05-25 16:13:03 +02:00
|
|
|
services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
|
|
|
|
|
2021-01-29 15:50:16 +01:00
|
|
|
# GPU
|
2023-02-11 22:53:54 +01:00
|
|
|
hardware.opengl = {
|
2023-08-19 10:49:11 +02:00
|
|
|
package = pkgs.mesa.drivers;
|
|
|
|
package32 = pkgs.pkgsi686Linux.mesa.drivers;
|
2023-02-11 22:53:54 +01:00
|
|
|
extraPackages = with pkgs; [
|
2023-08-19 10:49:11 +02:00
|
|
|
intel-compute-runtime
|
|
|
|
intel-compute-runtime.drivers
|
2023-02-11 22:53:54 +01:00
|
|
|
intel-media-driver
|
2023-08-19 10:49:11 +02:00
|
|
|
level-zero
|
2023-02-11 22:53:54 +01:00
|
|
|
libvdpau-va-gl
|
|
|
|
vaapiIntel
|
|
|
|
vaapiVdpau
|
2023-08-19 10:49:11 +02:00
|
|
|
];
|
2023-02-11 22:53:54 +01:00
|
|
|
};
|
2021-01-29 15:50:16 +01:00
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
clinfo
|
2024-06-02 14:01:44 +02:00
|
|
|
nvtopPackages.intel
|
2021-01-29 15:50:16 +01:00
|
|
|
];
|
2022-12-30 19:52:58 +01:00
|
|
|
|
2023-02-11 22:53:54 +01:00
|
|
|
security.wrappers."intel_gpu_top" = {
|
|
|
|
owner = "root";
|
|
|
|
group = "root";
|
|
|
|
capabilities = "cap_perfmon+p";
|
2023-08-19 10:49:11 +02:00
|
|
|
source = "${pkgs.intel-gpu-tools}/bin/intel_gpu_top";
|
2023-02-11 22:53:54 +01:00
|
|
|
};
|
|
|
|
|
2022-12-30 19:52:58 +01:00
|
|
|
# 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";
|
|
|
|
};
|
|
|
|
};
|
2023-01-22 16:35:02 +01:00
|
|
|
|
|
|
|
sbruder.fancontrol = {
|
2023-02-11 22:53:54 +01:00
|
|
|
enable = false; # no hwmon for intel arc (yet)
|
2023-01-22 16:35:02 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2020-10-17 23:18:22 +02:00
|
|
|
}
|