This repository has no description
2.9 kB
117 lines
1{ config, lib, 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 # disable back buttons
79 evdev:input:b0003v2F24p0135* # /dev/input/event2
80 KEYBOARD_KEY_70026=reserved
81 KEYBOARD_KEY_70027=reserved
82 '';
83
84 # update cpu microcode
85 hardware.cpu.amd.updateMicrocode = true;
86
87 hardware.opengl.enable = true;
88 hardware.opengl.extraPackages = [
89 pkgs.amdvlk
90 pkgs.rocm-opencl-icd
91 pkgs.rocm-opencl-runtime
92 ];
93
94 # suspend to disk
95 swapDevices = [{
96 device = "/swapfile";
97 }];
98 boot.resumeDevice = "/dev/mapper/aergia1";
99 services.logind.lidSwitch = "suspend-then-hibernate";
100 services.logind.extraConfig = ''
101 HandlePowerKey=hibernate
102 '';
103 # systemd.sleep.extraConfig = ''
104 # HibernateDelaySec=1800
105 # '';
106
107 # firefox touchscreen support
108 environment.sessionVariables.MOZ_USE_XINPUT2 = "1";
109
110 # enable thunderbolt
111 services.hardware.bolt.enable = true;
112
113 # reinit usb after docking station connect
114 services.udev.extraRules = ''
115 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'"
116 '';
117}