diff --git a/boot.nix b/boot.nix index 5ecf91e..fe61058 100644 --- a/boot.nix +++ b/boot.nix @@ -25,15 +25,15 @@ let enableRTGroupSched = { name = "enable-rt-group-sched"; patch = null; - extraConfig = '' - RT_GROUP_SCHED y - ''; + extraConfigStructuredConfig = with lib.kernel; { + RT_GROUP_SCHED = yes; + }; }; enableEnergyModel = { name = "enable-energy-model"; - patch = null; extraConfig = '' - ENERGY_MODEL y - ''; + patch = null; extraStructuredConfig = with lib.kernel; { + ENERGY_MODEL = yes; + }; }; removeKernelDRM = { name = "remove-kernel-drm"; @@ -41,24 +41,7 @@ let }; - amdClusterId = { - name = "cluster-id-amd"; - patch = pkgs.fetchpatch { - url = "https://lkml.org/lkml/diff/2023/4/10/479/1"; - hash = "sha256-bpe+iWYQldlGiIlWr4XPbIBPQBetEjfRKZ0Te2I14dk="; - }; - extraConfig = '' - SCHED_CLUSTER y - ''; - }; backports = { - zenLLCIdle = { - name = "zen-llc-idle"; - patch = pkgs.fetchpatch { - url = "https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/patch/?id=c5214e13ad60bd0022bab45cbac2c9db6bc1e0d4"; - hash = "sha256-3uDieD7XOaMM5yqOSvyLNsr2OqBxXESB5sM2gnGYoWk="; - }; - }; }; optimizeForCPUArch = arch: let @@ -150,7 +133,6 @@ in { patches = { amdClusterId.enable = mkEnableOption "Energy Model"; - zenLLCIdle.enable = mkEnableOption "Zen LLC Idle patch"; }; efi = mkOption rec { @@ -316,16 +298,25 @@ in { else baseKernel ; + moddedKernel = myLib.optimizations.addAttrs noDRMKernel moddedKernelAttrs; + + #patchedKernel = + # if (length config.boot.kernelPatches > 0) then + # moddedKernel.override (old: { + # structuredExtraConfig = mergeAttrs [ (old.structuredExtraConfig or {}) config.boot.kernelPatches.extraStructuredConfig ]; + # }) + # else + # moddedKernel + # ; + in mkOverride 2 (pkgs.linuxPackagesFor moddedKernel); kernelPatches = [] ++ optional cfg.x32abi.enable customKernelPatches.enableX32ABI ++ optional cfg.rtGroupSched.enable customKernelPatches.enableRTGroupSched ++ optional cfg.energyModel.enable customKernelPatches.enableEnergyModel - ++ optional (cfg.patches.amdClusterId.enable && kernelVersionOlder "6.4") customKernelPatches.amdClusterId - ++ optional (cfg.patches.zenLLCIdle.enable && kernelVersionOlder "6.5") customKernelPatches.backports.zenLLCIdle ++ optional (isXanmod cfg.kernel.package && config.aviallon.optimizations.enable) (customKernelPatches.optimizeForCPUArch config.aviallon.general.cpu.arch) ++ optional config.aviallon.optimizations.enable customKernelPatches.zstd ; diff --git a/desktop/developer.nix b/desktop/developer.nix index e82ac2b..9ed5329 100644 --- a/desktop/developer.nix +++ b/desktop/developer.nix @@ -53,6 +53,9 @@ in { gopls # Go ccls # C/C++ lua-language-server # Lua + nil # Nix + + nixfmt-rfc-style (hiPrio clinfo) # hiPrio to override HIP's clinfo binutils diff --git a/desktop/games.nix b/desktop/games.nix index 22eb0f8..4c799e5 100644 --- a/desktop/games.nix +++ b/desktop/games.nix @@ -70,15 +70,6 @@ in { }; enable = true; }; - security.wrappers = { - my-gamemoderun = { - source = "${pkgs.gamemode}/bin/gamemoderun"; - owner = "root"; - group = "gamers"; - capabilities = "cap_sys_nice=eip"; - permissions = "u+rx,g+x,o="; - }; - }; users.groups.gamers = { }; @@ -100,10 +91,16 @@ in { MESA_GLSL_CACHE_DIR = "${XDG_CACHE_HOME}/mesa"; }; + hardware.graphics.extraPackages = [ pkgs.gamescope-wsi ]; + hardware.graphics.extraPackages32 = [ pkgs.pkgsi686Linux.gamescope-wsi ]; + programs.steam.package = pkgs.steam.override { extraPkgs = pkgs: [ - pkgs.gamescope + config.programs.gamescope.package ]; + #extraLibraries = pkgs: [ + # config.programs.gamescope.package.override { enableExecutable = false; enableWsi = true; } + #]; }; aviallon.programs.allowUnfreeList = [ diff --git a/desktop/multimedia.nix b/desktop/multimedia.nix index 8408936..bfce41f 100644 --- a/desktop/multimedia.nix +++ b/desktop/multimedia.nix @@ -32,7 +32,7 @@ in { yt-dlp jellyfin-media-player - jamesdsp # Audio post-processing + #jamesdsp # Audio post-processing ]; nixpkgs.overlays = [(final: prev: { diff --git a/hardware/amd/cpu.nix b/hardware/amd/cpu.nix index 0dc264b..c6a97a0 100644 --- a/hardware/amd/cpu.nix +++ b/hardware/amd/cpu.nix @@ -2,7 +2,7 @@ with lib; let generalCfg = config.aviallon.general; - cpuIsZen = ! isNull (builtins.match "znver[0-9]" generalCfg.cpu.arch); + enableZenpower = (! isNull (builtins.match "znver[1-3]" generalCfg.cpu.arch)) && (versionOlder kernelVersion "6.13"); kernelVersion = getVersion config.boot.kernelPackages.kernel; in { config = mkIf (generalCfg.cpu.vendor == "amd") { @@ -27,20 +27,18 @@ in { "amd_pstate.shared_memory" = 1; }; - aviallon.boot.patches = mkIf config.aviallon.optimizations.enable { - amdClusterId.enable = mkIf cpuIsZen true; - }; + aviallon.boot.patches = mkIf config.aviallon.optimizations.enable {}; boot.extraModulePackages = with config.boot.kernelPackages; [] - ++ optional cpuIsZen (info "enable zenpower for Ryzen CPU" zenpower) + ++ optional enableZenpower (info "enable zenpower for Ryzen [1-3] CPU" zenpower) ; boot.kernelModules = [] - ++ optional cpuIsZen "zenpower" + ++ optional enableZenpower "zenpower" ; boot.blacklistedKernelModules = [] - ++ optional cpuIsZen "k10-temp" # Superseded by zenpower + ++ optional enableZenpower "k10-temp" # Superseded by zenpower ; }; } diff --git a/hardware/amd/rocm.nix b/hardware/amd/rocm.nix index 290bb6d..1bbde77 100644 --- a/hardware/amd/rocm.nix +++ b/hardware/amd/rocm.nix @@ -47,6 +47,26 @@ in { example = "gfx902"; type = types.string; }; + gpuTargets = mkOption { + description = "Override supported GPU ISAs in some ROCm packages."; + default = [ "803" + "900" + "906:xnack-" + "908:xnack-" + "90a:xnack+" "90a:xnack-" + "940" + "941" + "942" + "1010" + "1012" + "1030" + "1031" + "1100" + "1101" + "1102" ]; + example = [ "900" "1031" ]; + type = with types; nullOr (listOf string); + }; }; config = mkIf (cfg.enable && localCfg.enable) { @@ -54,7 +74,7 @@ in { [ rocmPackages.rocm-smi #rocmPackages.meta.rocm-ml-libraries - rocmPackages.meta.rocm-hip-runtime + #rocmPackages.meta.rocm-hip-runtime #pkgs.autoDetectGPU ] ++ optionals devCfg.enable [ @@ -86,44 +106,20 @@ in { nixpkgs.config.rocmSupport = true; nixpkgs.overlays = mkBefore [(final: prev: { - # Overlay Blender to use the HIP build if we have a compatible AMD GPU - blender = final.blender-hip; - blender-cpu = prev.blender; - - magma = final.magma-hip; - magma-cpu = prev.magma; - - #autoDetectGPU = autoDetectGPU final; - - rocmPackages = prev.rocmPackages // rec { - rocmlir = prev.rocmPackages.rocmlir.overrideAttrs (finalAttrs: previousAttrs: { - patches = [ - (prev.fetchpatch { - name = "fix-mlir-Conversion-RocMLIRPasses.h.inc-not-found.patch"; - url = "https://patch-diff.githubusercontent.com/raw/ROCm/rocMLIR/pull/1640.patch"; - hash = "sha256-przg1AQZTiVbVd/4wA+KlGXu/RISO5n11FBkmUFKRSA="; - }) - ]; + rocmPackages_5 = final.rocmPackages; + rocmPackages = prev.rocmPackages // { + clr = prev.rocmPackages.clr.overrideAttrs (oldAttrs: { + passthru = oldAttrs.passthru // { + # We cannot use this for each ROCm library, as each defines their own supported targets + # See: https://github.com/ROCm/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix + gpuTargets = lib.forEach localCfg.gpuTargets (target: "gfx${target}"); + }; }); - rocblas = prev.hello; - - rocmlir-rock = rocmlir.override { - buildRockCompiler = true; + rocblas = prev.rocmPackages.rocblas.override { + gpuTargets = lib.forEach localCfg.gpuTargets (target: "gfx${target}"); }; - - miopen = prev.rocmPackages.miopen.override { rocmlir = rocmlir-rock; }; - - migraphx = prev.rocmPackages.migraphx.override { rocmlir = rocmlir-rock; }; - - tensile = prev.rocmPackages.tensile.overrideAttrs (old: { - # TODO: remove this workaround once https://github.com/NixOS/nixpkgs/pull/323869 - # does not cause issues anymore, or at least replace it with a better orkaround - setupHook = writeText "setup-hook" '' - export TENSILE_ROCM_ASSEMBLER_PATH="${stdenv.cc.cc}/bin/clang++"; - ''; - }); }; - })]; + })]; }; }