vrr patch

vrr patch
This commit is contained in:
Tao Tien 2024-03-24 16:39:32 -07:00
parent e73dff2901
commit 8ed30548f7
3 changed files with 120 additions and 20 deletions

46
flake.lock generated
View file

@ -138,6 +138,28 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"plasma-manager",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710888565,
"narHash": "sha256-s9Hi4RHhc6yut4EcYD50sZWRDKsugBJHSbON8KFwoTw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f33900124c23c4eca5831b9b5eb32ea5894375ce",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.11",
"repo": "home-manager",
"type": "github"
}
},
"jujutsu": { "jujutsu": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
@ -285,6 +307,27 @@
"type": "indirect" "type": "indirect"
} }
}, },
"plasma-manager": {
"inputs": {
"home-manager": "home-manager_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1711295162,
"narHash": "sha256-gPTTYKvdnmaLcgOSpqtKHIf8J60J3Z4jAqXTwluxxUk=",
"owner": "pjones",
"repo": "plasma-manager",
"rev": "8a032af55ed686ab21e60530080462a1438812b9",
"type": "github"
},
"original": {
"owner": "pjones",
"repo": "plasma-manager",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"helix": "helix", "helix": "helix",
@ -293,7 +336,8 @@
"nixos-cosmic": "nixos-cosmic", "nixos-cosmic": "nixos-cosmic",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixos-raspberrypi": "nixos-raspberrypi", "nixos-raspberrypi": "nixos-raspberrypi",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2",
"plasma-manager": "plasma-manager"
} }
}, },
"rust-overlay": { "rust-overlay": {

View file

@ -1,4 +1,12 @@
{pkgs, ...}: { {
pkgs,
config,
...
}: let
amdgpu-kernel-module = pkgs.callPackage ./vrr_patch.nix {
kernel = config.boot.kernelPackages.kernel;
};
in {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# prescurve # prescurve
libinput libinput
@ -45,6 +53,34 @@
services.xserver.displayManager.defaultSession = "plasma"; services.xserver.displayManager.defaultSession = "plasma";
services.xserver.displayManager.sddm.wayland.enable = true; services.xserver.displayManager.sddm.wayland.enable = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.availableKernelModules = [
"nvme"
"sd_mod"
"thunderbolt"
"usb_storage"
"xhci_pci"
"usbhid"
"uas"
];
boot.kernelParams = [
# "mem_sleep_default=deep"
# "nvme.noacpi=1"
];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [
(amdgpu-kernel-module.overrideAttrs (_: {
patches = [
(pkgs.fetchurl {
url = "https://gitlab.freedesktop.org/agd5f/linux/-/commit/2f14c0c8cae8e9e3b603a3f91909baba66540027.diff";
hash = "sha256-0++twr9t4AkJXZfj0aHGMVDuOhxtLP/q2d4FGfggnww=";
})
];
}))
];
powerManagement.cpuFreqGovernor = "powersave";
systemd.sleep.extraConfig = "HibernateDelaySec=180m";
fileSystems."/home/tao/games" = { fileSystems."/home/tao/games" = {
device = "/dev/disk/by-uuid/d97a81dc-669c-41d1-912b-829f88fd6f69"; device = "/dev/disk/by-uuid/d97a81dc-669c-41d1-912b-829f88fd6f69";
fsType = "btrfs"; fsType = "btrfs";
@ -66,23 +102,5 @@
}; };
swapDevices = [{device = "/dev/disk/by-uuid/36216521-db46-4bb0-8994-38a36d5c4528";}]; swapDevices = [{device = "/dev/disk/by-uuid/36216521-db46-4bb0-8994-38a36d5c4528";}];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.availableKernelModules = [
"nvme"
"sd_mod"
"thunderbolt"
"usb_storage"
"xhci_pci"
"usbhid"
"uas"
];
boot.kernelParams = [
# "mem_sleep_default=deep"
# "nvme.noacpi=1"
];
boot.kernelModules = ["kvm-amd"];
powerManagement.cpuFreqGovernor = "powersave";
systemd.sleep.extraConfig = "HibernateDelaySec=180m";
networking.hostName = "NOlaptop"; networking.hostName = "NOlaptop";
} }

38
systems/vrr_patch.nix Normal file
View file

@ -0,0 +1,38 @@
{
pkgs,
lib,
kernel ? pkgs.linuxPackages_latest.kernel,
}:
pkgs.stdenv.mkDerivation {
pname = "amdgpu-kernel-module";
inherit (kernel) src version postPatch nativeBuildInputs;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
modulePath = "drivers/gpu/drm/amd/amdgpu";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
meta = {
description = "AMD GPU kernel module";
license = lib.licenses.gpl3;
};
}