2023-01-26 15:13:42 +00:00
|
|
|
{ config, lib, pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./config.nix
|
|
|
|
(modulesPath + "/installer/scan/not-detected.nix")
|
|
|
|
];
|
|
|
|
disko.devices = import ./disk.nix;
|
|
|
|
|
|
|
|
networking.hostId = "deadbeef";
|
|
|
|
# boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
boot.loader.grub = {
|
|
|
|
enable = true;
|
|
|
|
device = "/dev/nvme0n1";
|
|
|
|
efiSupport = true;
|
|
|
|
efiInstallAsRemovable = true;
|
|
|
|
};
|
|
|
|
|
2023-01-29 23:27:34 +00:00
|
|
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
|
|
|
|
|
|
|
boot.kernelParams = [
|
|
|
|
# Enable energy savings during sleep
|
|
|
|
"mem_sleep_default=deep"
|
2023-02-06 11:49:09 +00:00
|
|
|
|
|
|
|
"amd_pstate=passive"
|
2023-01-29 23:27:34 +00:00
|
|
|
|
|
|
|
# for ryzenadj -i
|
|
|
|
"iomem=relaxed"
|
|
|
|
];
|
2023-01-26 15:13:42 +00:00
|
|
|
|
2023-02-06 11:49:09 +00:00
|
|
|
boot.kernelModules = [
|
|
|
|
# Enables the amd cpu scaling https://www.kernel.org/doc/html/latest/admin-guide/pm/amd-pstate.html
|
|
|
|
# On recent AMD CPUs this can be more energy efficient.
|
|
|
|
"amd-pstate"
|
|
|
|
"kvm-amd"
|
|
|
|
|
|
|
|
# needed for zenstates
|
|
|
|
"msr"
|
|
|
|
|
|
|
|
# zenpower
|
|
|
|
"zenpower"
|
|
|
|
];
|
|
|
|
|
|
|
|
boot.extraModulePackages = [
|
|
|
|
(config.boot.kernelPackages.zenpower.overrideAttrs (old: {
|
|
|
|
src = pkgs.fetchFromGitea {
|
|
|
|
domain = "git.exozy.me";
|
|
|
|
owner = "a";
|
|
|
|
repo = "zenpower3";
|
|
|
|
rev = "c176fdb0d5bcba6ba2aba99ea36812e40f47751f";
|
|
|
|
hash = "sha256-d2WH8Zv7F0phZmEKcDiaak9On+Mo9bAFhMulT/N5FWI=";
|
|
|
|
};
|
|
|
|
}))
|
|
|
|
];
|
2023-01-26 15:13:42 +00:00
|
|
|
|
|
|
|
# hardware.cpu.amd.updateMicrocode = true;
|
|
|
|
|
|
|
|
services.xserver.videoDrivers = [
|
|
|
|
"amdgpu"
|
|
|
|
];
|
|
|
|
|
2023-02-06 11:49:09 +00:00
|
|
|
boot.initrd.availableKernelModules = [
|
|
|
|
"nvme"
|
|
|
|
"thunderbolt"
|
|
|
|
"xhci_pci"
|
|
|
|
"usbhid"
|
|
|
|
];
|
|
|
|
|
|
|
|
boot.initrd.kernelModules = [
|
|
|
|
"amdgpu"
|
|
|
|
];
|
2023-01-26 15:13:42 +00:00
|
|
|
|
|
|
|
environment.systemPackages = [
|
2023-01-29 23:27:34 +00:00
|
|
|
pkgs.vulkan-tools
|
2023-01-26 15:13:42 +00:00
|
|
|
pkgs.ryzenadj
|
2023-01-29 23:27:34 +00:00
|
|
|
(pkgs.writers.writeDashBin "set_tdp" ''
|
|
|
|
set -efux
|
|
|
|
watt=$1
|
|
|
|
value=$(( $watt * 1000 ))
|
|
|
|
${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit="$value" --fast-limit="$value" --slow-limit="$value"
|
|
|
|
'')
|
2023-01-26 15:13:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# textsize
|
|
|
|
services.xserver.dpi = 200;
|
2023-01-29 23:27:34 +00:00
|
|
|
hardware.video.hidpi.enable = lib.mkDefault true;
|
|
|
|
|
|
|
|
# corectrl
|
2023-02-06 11:49:09 +00:00
|
|
|
programs.corectrl = {
|
|
|
|
enable = true;
|
|
|
|
gpuOverclock = {
|
|
|
|
enable = true;
|
|
|
|
ppfeaturemask = "0xffffffff";
|
|
|
|
};
|
|
|
|
};
|
2023-01-29 23:27:34 +00:00
|
|
|
users.users.mainUser.extraGroups = [ "corectrl" ];
|
|
|
|
|
|
|
|
# use newer ryzenadj
|
|
|
|
nixpkgs.config.packageOverrides = super: {
|
|
|
|
ryzenadj = super.ryzenadj.overrideAttrs (old: {
|
|
|
|
version = "unstable-2023-01-15";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "FlyGoat";
|
|
|
|
repo = "RyzenAdj";
|
|
|
|
rev = "1052fb52b2c0e23ac4cd868c4e74d4a9510be57c"; # unstable on 2023-01-15
|
|
|
|
sha256 = "sha256-/IxkbQ1XrBrBVrsR4EdV6cbrFr1m+lGwz+rYBqxYG1k=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
2023-01-30 14:53:59 +00:00
|
|
|
|
|
|
|
# keyboard quirks
|
|
|
|
services.xserver.displayManager.sessionCommands = ''
|
2023-02-06 11:50:00 +00:00
|
|
|
${pkgs.xorg.xmodmap}/bin/xmodmap -e 'keycode 96 = F12 Insert F12 F12' # rebind shift + F12 to shift + insert
|
2023-01-30 14:53:59 +00:00
|
|
|
'';
|
2023-01-30 15:13:28 +00:00
|
|
|
services.udev.extraHwdb = /* sh */ ''
|
|
|
|
# disable back buttons
|
|
|
|
evdev:input:b0003v2F24p0135* # /dev/input/event2
|
|
|
|
KEYBOARD_KEY_70026=reserved
|
|
|
|
KEYBOARD_KEY_70027=reserved
|
|
|
|
'';
|
2023-01-30 15:13:47 +00:00
|
|
|
|
|
|
|
# ignore power key
|
|
|
|
services.logind.extraConfig = "HandlePowerKey=ignore";
|
2023-01-26 15:13:42 +00:00
|
|
|
}
|