nixos-config/machines/hyper/hardware-configuration.nix

82 lines
2.1 KiB
Nix
Raw Normal View History

2024-03-10 11:40:29 +01:00
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
# fan control configuration from https://gist.github.com/bakman2/e801f342aaa7cade62d7bd54fd3eabd8
kernelModules = [ "kvm-amd" "it87" ];
kernelParams = [
"acpi_enforce_resources=lax" # allow it87 to load
"ip=dhcp"
"iommu=pt"
"default_hugepagesz=1G"
"hugepagesz=1G"
"hugepages=90"
];
extraModulePackages = with config.boot.kernelPackages; [ it87 ];
extraModprobeConfig = ''
options it87 force_id=0x8688
options vfio-pci ids=8086:56a0,8086:4f90
softdep drm pre: vfio-pci
options kvm-amd nested=0 avic=1 npt=1
'';
loader = {
grub.enable = false;
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "ehci_pci" "nvme" "r8169" "sd_mod" "sr_mod" "usb_storage" "usbhid" "xhci_pci" ];
kernelModules = [ "dm-snapshot" ];
luks.devices = {
root = {
name = "root";
device = "/dev/disk/by-uuid/63d366bd-5453-46b5-89d5-a61cbb828102";
preLVM = true;
allowDiscards = true;
};
};
};
};
2024-03-19 17:10:34 +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";
};
};
2024-03-10 11:40:29 +01:00
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/53f4e762-39fa-41a6-8b78-4999d38e6e88";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/403C-02C1";
fsType = "vfat";
};
};
}