From 7d3f9b37a0ef8c77df77d2a2c863285912bb5497 Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Sat, 15 Mar 2025 13:45:24 +0100 Subject: [PATCH] use amd's drm-next branch --- .config/i3/config | 4 +- flake.lock | 24 +++++----- modules/graphical/games.nix | 2 +- modules/graphical/sddm.nix | 7 +-- modules/hardware/amd-gpu.nix | 26 +++++------ modules/kernel.nix | 86 ++++++++++++++++++++++++++++++++++-- systems/pc/configuration.nix | 2 +- 7 files changed, 113 insertions(+), 38 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 8fcef21..6d8ab25 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -362,8 +362,8 @@ exec --no-startup-id /usr/bin/env dunst #exec --no-startup-id sleep 7 && firefox https://github.com/endeavouros-team/endeavouros-i3wm-setup/blob/main/force-knowledge.md #exec --no-startup-id sleep 3 && thunar exec --no-startup-id i3-msg workspace $ws9; exec discord -exec --no-startup-id i3-msg workspace $ws10; exec floorp - +exec --no-startup-id i3-msg workspace $ws10; exec firefox +exec --no-startup-id sleep 3 && killall picom ############### # system tray # ############### diff --git a/flake.lock b/flake.lock index de1eaa6..3488395 100644 --- a/flake.lock +++ b/flake.lock @@ -443,11 +443,11 @@ ] }, "locked": { - "lastModified": 1741894454, - "narHash": "sha256-Mu2YXrGr/8Cid6W44AXci/YYnASoXjGrMV9Sjs66oyc=", + "lastModified": 1741955947, + "narHash": "sha256-2lbURKclgKqBNm7hVRtWh0A7NrdsibD0EaWhahUVhhY=", "owner": "nix-community", "repo": "home-manager", - "rev": "0b0baed7b2bf6a5e365d4cba042b580a2bc32e34", + "rev": "4e12151c9e014e2449e0beca2c0e9534b96a26b4", "type": "github" }, "original": { @@ -528,11 +528,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1741864154, - "narHash": "sha256-A39pa4ZmUqSjuE2L4swvHKGUQ2maKiY0P5UduZ+yE90=", + "lastModified": 1741919923, + "narHash": "sha256-ZBKD3Rd8fCu8TaGr2bkHqai3bqxKuUBOFLLMWThcGKM=", "owner": "lilyinstarlight", "repo": "nixos-cosmic", - "rev": "05f8b43a311b3a1f914af89a94480b19d2eceac6", + "rev": "24785e84d4b3844936caffe2c56994bdef9a9300", "type": "github" }, "original": { @@ -753,11 +753,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1741895983, - "narHash": "sha256-7CqlVqSsc/H4dy0P034L0IrWzueShNR3fvN6GQQE2E0=", + "lastModified": 1741964028, + "narHash": "sha256-Fh4zKt0kn2kZ63bkCQ4c9suDbz4pYcsFP/5J5pJJKa8=", "owner": "nix-community", "repo": "NUR", - "rev": "1cf775289a4bd43ebeae46cc351d200aa4ed1c04", + "rev": "fc4860b6b689a8b96faafb157d390f26878590be", "type": "github" }, "original": { @@ -859,11 +859,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1741880767, - "narHash": "sha256-tXtop1zIJMyRt1LDERIWwMAMVKdfDtFp/g37YKy2Ke4=", + "lastModified": 1741960086, + "narHash": "sha256-8S32m8oU2xZGXevtkS//vMKVY1JLHWUQVPIROl4eo6Q=", "owner": "danth", "repo": "stylix", - "rev": "5053a63c87fea3508439b7e9c1a66fa6979a4694", + "rev": "6a2e5258876c46b62edacb3e51a759ed1c06332b", "type": "github" }, "original": { diff --git a/modules/graphical/games.nix b/modules/graphical/games.nix index d94698a..cf46741 100644 --- a/modules/graphical/games.nix +++ b/modules/graphical/games.nix @@ -16,7 +16,7 @@ in { dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server gamescopeSession.enable = true; - extraCompatPackages = with pkgs; [ proton-ge-bin ]; + extraCompatPackages = with pkgs; [ proton-ge-bin steamtinkerlaunch ]; }; programs.gamemode = { enable = true; diff --git a/modules/graphical/sddm.nix b/modules/graphical/sddm.nix index 74431cc..347a733 100644 --- a/modules/graphical/sddm.nix +++ b/modules/graphical/sddm.nix @@ -12,9 +12,10 @@ in { config = lib.mkIf cfg.enable { services = { - displayManager = { - sddm.enable = true; - sddm.theme = "${pkgs.sddm-astronaut}"; + displayManager.sddm = { + enable = true; + theme = "${pkgs.sddm-astronaut}"; + #wayland.enable = true; #sddm.theme = "breeze"; }; }; diff --git a/modules/hardware/amd-gpu.nix b/modules/hardware/amd-gpu.nix index dbac0ad..bf43a7c 100644 --- a/modules/hardware/amd-gpu.nix +++ b/modules/hardware/amd-gpu.nix @@ -6,31 +6,25 @@ in { }; config = lib.mkIf cfg.enable { - boot.kernelParams = [ "amdgpu.ppfeaturemask=0xffffffff" "split_lock_detect=off" ]; + boot.kernelParams = + [ "amdgpu.ppfeaturemask=0xfff7ffff" "split_lock_detect=off" ]; + hardware.graphics = { enable = true; enable32Bit = true; package = lib.mkForce pkgs.mesa-git.mesa.drivers; - #extraPackages = with pkgs; [ mesa-git.amdvlk ]; + extraPackages = with pkgs; [ mesa-git.amdvlk ]; }; - boot.initrd.kernelModules = [ "amdgpu" ]; + hardware.amdgpu.initrd.enable = lib.mkDefault true; services.xserver.videoDrivers = [ "amdgpu" ]; # controller (overclock, undervolt, fan curves) - environment.systemPackages = with pkgs; [ lact nvtopPackages.amd ]; + environment.systemPackages = with pkgs; [ + lact + nvtopPackages.amd + amdgpu_top + ]; systemd.packages = with pkgs; [ lact ]; systemd.services.lactd.wantedBy = [ "multi-user.target" ]; - - hardware.firmware = with pkgs; - [ - (linux-firmware.overrideAttrs (old: { - src = builtins.fetchGit { - url = - "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"; - rev = - "b4cb02b2dc3330c6e5d69e84a616b1ca5faecf12"; # Uncomment this line to allow for pure builds - }; - })) - ]; }; } diff --git a/modules/kernel.nix b/modules/kernel.nix index 4208a22..145006b 100644 --- a/modules/kernel.nix +++ b/modules/kernel.nix @@ -1,5 +1,85 @@ -{pkgs, ...}: -{ +{ pkgs, config, ... }: +let +#amdgpu_module_pkg = +# { pkgs, lib, fetchurl, kernel ? pkgs.linuxPackages_latest.kernel, ... }: +# +# pkgs.stdenv.mkDerivation { +# pname = "amdgpu-kernel-module"; +# inherit (kernel) version postPatch nativeBuildInputs; +# src = fetchurl { +# url = +# "https://gitlab.freedesktop.org/agd5f/linux/-/archive/amd-drm-next-6.15-2025-03-14/linux-amd-drm-next-6.15-2025-03-14.tar.gz"; +# # After the first build attempt, look for "hash mismatch" and then 2 lines below at the "got:" line. +# # Use "sha256-....." value here. +# hash = "sha256-/9EvJNBSKteXljrZzmaQkbZ7o4etCe0yFM3JJg/jD7o="; +# }; +# +# 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; +# }; +# }; +# amdgpu_module = pkgs.callPackage amdgpu_module_pkg { +# kernel = config.boot.kernelPackages.kernel; +# }; + +in { + #boot.extraModulePackages = [ amdgpu_module ]; #boot.kernelPackages = pkgs.linuxPackages_latest; - boot.kernelPackages = pkgs.linuxPackages_testing; + #boot.kernelPackages = pkgs.linuxPackages_testing; + #boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_6_13.override { + # argsOverride = rec { + # src = pkgs.fetchurl { + # url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; + # sha256 = "07c08x68fgcsgriss5z8w427h69y52s887vas91jzb5p70hbcf9s"; + # }; + # version = "6.13.7"; + # modDirVersion = "6.13.7"; + # }; + #}); + + boot.kernelPackages = let + amd_drm_next_pkg = { fetchurl, buildLinux, ... }@args: + + buildLinux (args // rec { + version = "6.14.0-rc4"; + modDirVersion = version; + + src = fetchurl { + url = + "https://gitlab.freedesktop.org/agd5f/linux/-/archive/amd-drm-next-6.15-2025-03-14/linux-amd-drm-next-6.15-2025-03-14.tar.gz"; + # After the first build attempt, look for "hash mismatch" and then 2 lines below at the "got:" line. + # Use "sha256-....." value here. + hash = "sha256-/9EvJNBSKteXljrZzmaQkbZ7o4etCe0yFM3JJg/jD7o="; + }; + kernelPatches = [ ]; + + extraMeta.branch = "6.14.0-rc4"; + } // (args.argsOverride or { })); + linux_amd_drm_next = pkgs.callPackage amd_drm_next_pkg { }; + in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_amd_drm_next); } diff --git a/systems/pc/configuration.nix b/systems/pc/configuration.nix index 809cf02..b1a0820 100644 --- a/systems/pc/configuration.nix +++ b/systems/pc/configuration.nix @@ -19,7 +19,7 @@ ]; custom = { - tmpfs.enable = true; + #tmpfs.enable = true; wireshark.enable = true; virt-manager.enable = true; nftables.enable = true;