This repository has no description
2.9 kB
120 lines
1{ pkgs, modulesPath, ... }:
2{
3 imports = [
4 ./config.nix
5 (modulesPath + "/installer/scan/not-detected.nix")
6 ../../2configs/antimicrox
7 ./disk.nix
8 ];
9
10 networking.hostId = "deadbeef";
11 # boot.loader.efi.canTouchEfiVariables = true;
12 boot.loader.grub = {
13 enable = true;
14 device = "/dev/nvme0n1";
15 efiSupport = true;
16 efiInstallAsRemovable = true;
17 };
18
19 # boot.kernelPackages = pkgs.linuxPackages_latest;
20
21 boot.kernelParams = [
22 # use less power with pstate
23 "amd_pstate=passive"
24
25 # suspend
26 "resume_offset=178345675"
27 ];
28
29 boot.kernelModules = [
30 # Enables the amd cpu scaling https://www.kernel.org/doc/html/latest/admin-guide/pm/amd-pstate.html
31 # On recent AMD CPUs this can be more energy efficient.
32 "amd-pstate"
33 "kvm-amd"
34 ];
35
36 # hardware.cpu.amd.updateMicrocode = true;
37
38 services.xserver.videoDrivers = [
39 "amdgpu"
40 ];
41
42 boot.initrd.availableKernelModules = [
43 "nvme"
44 "thunderbolt"
45 "xhci_pci"
46 "usbhid"
47 ];
48
49 boot.initrd.kernelModules = [
50 "amdgpu"
51 ];
52
53 environment.systemPackages = [
54 pkgs.vulkan-tools
55 (pkgs.writers.writeDashBin "set_tdp" ''
56 set -efux
57 watt=$1
58 value=$(( $watt * 1000 ))
59 ${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit="$value" --fast-limit="$value" --slow-limit="$value"
60 '')
61 ];
62
63 # corectrl
64 programs.corectrl = {
65 enable = true;
66 gpuOverclock = {
67 enable = true;
68 ppfeaturemask = "0xffffffff";
69 };
70 };
71 users.users.mainUser.extraGroups = [ "corectrl" ];
72
73 # keyboard quirks
74 services.xserver.displayManager.sessionCommands = ''
75 ${pkgs.xorg.xmodmap}/bin/xmodmap -e 'keycode 96 = F12 Insert F12 F12' # rebind shift + F12 to shift + insert
76 '';
77 services.udev.extraHwdb = # sh
78 ''
79 # disable back buttons
80 evdev:input:b0003v2F24p0135* # /dev/input/event2
81 KEYBOARD_KEY_70026=reserved
82 KEYBOARD_KEY_70027=reserved
83 '';
84
85 # update cpu microcode
86 hardware.cpu.amd.updateMicrocode = true;
87
88 hardware.opengl.enable = true;
89 hardware.opengl.extraPackages = [
90 pkgs.amdvlk
91 pkgs.rocm-opencl-icd
92 pkgs.rocm-opencl-runtime
93 ];
94
95 # suspend to disk
96 swapDevices = [
97 {
98 device = "/swapfile";
99 }
100 ];
101 boot.resumeDevice = "/dev/mapper/aergia1";
102 services.logind.lidSwitch = "suspend-then-hibernate";
103 services.logind.extraConfig = ''
104 HandlePowerKey=hibernate
105 '';
106 # systemd.sleep.extraConfig = ''
107 # HibernateDelaySec=1800
108 # '';
109
110 # firefox touchscreen support
111 environment.sessionVariables.MOZ_USE_XINPUT2 = "1";
112
113 # enable thunderbolt
114 services.hardware.bolt.enable = true;
115
116 # reinit usb after docking station connect
117 services.udev.extraRules = ''
118 SUBSYSTEM=="drm", ACTION=="change", RUN+="${pkgs.dash}/bin/dash -c 'echo 0 > /sys/bus/usb/devices/usb9/authorized; echo 1 > /sys/bus/usb/devices/usb9/authorized'"
119 '';
120}