-
Notifications
You must be signed in to change notification settings - Fork 57
/
hardware-configuration.nix
116 lines (98 loc) · 3.76 KB
/
hardware-configuration.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, inputs, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
services.fstrim.enable = true;
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "radeon" ];
boot.initrd.kernelModules = [ "radeon" ];
boot.kernelModules = [ "kvm-amd" "radeon" "zenpower" "8812au" ];
boot.blacklistedKernelModules = [ "k10temp" ];
boot.kernelParams = [ "amd_pstate=active" ];
boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower rtl8812au ];
hardware.opengl.extraPackages = [ pkgs.rocmPackages.clr.icd ];
hardware.opengl.extraPackages32 = [ ];
environment.systemPackages = with pkgs.rocmPackages; [ hipcc hip-common hiprand hipblas hipfft hipcub hipify ];
services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ];
hardware.graphics = {
enable = lib.mkDefault true;
enable32Bit = lib.mkDefault true;
};
hardware.amdgpu.initrd.enable = true;
hardware.amdgpu.opencl.enable = true;
hardware.amdgpu.amdvlk.enable = true;
systemd.tmpfiles.rules =
let
rocmEnv = pkgs.symlinkJoin {
name = "rocm-combined";
paths = with pkgs.rocmPackages; [
rocblas
hipblas
clr
];
};
in [
"L+ /opt/rocm - - - - ${rocmEnv}"
];
# my stupid usb hub crashes systemct suspend half of the time now
# https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Sleep_hooks
systemd.services.root-suspend = {
enable = true;
description = "Root systemd suspend prehook";
unitConfig = {
Description = "Root systemd suspend prehook";
Before = "sleep.target";
};
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.uhubctl}/bin/uhubctl -a off";
};
wantedBy = [ "sleep.target" ];
};
systemd.services.root-resume = {
enable = true;
description = "Root systemd suspend posthook";
unitConfig = {
Description = "Root systemd suspend posthook";
After = "suspend.target";
};
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.uhubctl}/bin/uhubctl -a on";
};
wantedBy = [ "suspend.target" ];
};
boot.kernel.sysctl = {
"vm.swappiness" = 90;
"vm.vfs_cache_pressure" = 50;
"vm.dirty_background_ratio" = 2;
"vm.dirty_ratio" = 5;
};
services.btrfs.autoScrub = {
enable = true;
interval = "weekly";
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/637d8261-0650-4ece-a35b-59d97baf64a7";
fsType = "btrfs";
options = [ "noatime,compress-force=zstd:2,discard=async,commit=120,clear_cache,space_cache=v2,subvol=@" ];
};
boot.initrd.luks.devices."luks-385106b5-71f7-460e-9a2b-2416f3b54cb6".device = "/dev/disk/by-uuid/385106b5-71f7-460e-9a2b-2416f3b54cb6";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/F09D-73C9";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}