mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
Compare commits
No commits in common. "d38185f99457718228e7f59f987ad85ef7b778a0" and "bb6167236adff855c425a78b9d942507da2914bb" have entirely different histories.
d38185f994
...
bb6167236a
6 changed files with 80 additions and 65 deletions
43
boot.nix
43
boot.nix
|
|
@ -25,15 +25,15 @@ let
|
||||||
enableRTGroupSched = {
|
enableRTGroupSched = {
|
||||||
name = "enable-rt-group-sched";
|
name = "enable-rt-group-sched";
|
||||||
patch = null;
|
patch = null;
|
||||||
extraConfigStructuredConfig = with lib.kernel; {
|
extraConfig = ''
|
||||||
RT_GROUP_SCHED = yes;
|
RT_GROUP_SCHED y
|
||||||
};
|
'';
|
||||||
};
|
};
|
||||||
enableEnergyModel = {
|
enableEnergyModel = {
|
||||||
name = "enable-energy-model";
|
name = "enable-energy-model";
|
||||||
patch = null; extraStructuredConfig = with lib.kernel; {
|
patch = null; extraConfig = ''
|
||||||
ENERGY_MODEL = yes;
|
ENERGY_MODEL y
|
||||||
};
|
'';
|
||||||
};
|
};
|
||||||
removeKernelDRM = {
|
removeKernelDRM = {
|
||||||
name = "remove-kernel-drm";
|
name = "remove-kernel-drm";
|
||||||
|
|
@ -41,7 +41,24 @@ 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 = {
|
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
|
optimizeForCPUArch = arch: let
|
||||||
|
|
@ -133,6 +150,7 @@ in {
|
||||||
|
|
||||||
patches = {
|
patches = {
|
||||||
amdClusterId.enable = mkEnableOption "Energy Model";
|
amdClusterId.enable = mkEnableOption "Energy Model";
|
||||||
|
zenLLCIdle.enable = mkEnableOption "Zen LLC Idle patch";
|
||||||
};
|
};
|
||||||
|
|
||||||
efi = mkOption rec {
|
efi = mkOption rec {
|
||||||
|
|
@ -299,24 +317,15 @@ in {
|
||||||
baseKernel
|
baseKernel
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
moddedKernel = myLib.optimizations.addAttrs noDRMKernel moddedKernelAttrs;
|
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);
|
in mkOverride 2 (pkgs.linuxPackagesFor moddedKernel);
|
||||||
|
|
||||||
kernelPatches = []
|
kernelPatches = []
|
||||||
++ optional cfg.x32abi.enable customKernelPatches.enableX32ABI
|
++ optional cfg.x32abi.enable customKernelPatches.enableX32ABI
|
||||||
++ optional cfg.rtGroupSched.enable customKernelPatches.enableRTGroupSched
|
++ optional cfg.rtGroupSched.enable customKernelPatches.enableRTGroupSched
|
||||||
++ optional cfg.energyModel.enable customKernelPatches.enableEnergyModel
|
++ 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 (isXanmod cfg.kernel.package && config.aviallon.optimizations.enable) (customKernelPatches.optimizeForCPUArch config.aviallon.general.cpu.arch)
|
||||||
++ optional config.aviallon.optimizations.enable customKernelPatches.zstd
|
++ optional config.aviallon.optimizations.enable customKernelPatches.zstd
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,6 @@ in {
|
||||||
gopls # Go
|
gopls # Go
|
||||||
ccls # C/C++
|
ccls # C/C++
|
||||||
lua-language-server # Lua
|
lua-language-server # Lua
|
||||||
nil # Nix
|
|
||||||
|
|
||||||
nixfmt-rfc-style
|
|
||||||
|
|
||||||
(hiPrio clinfo) # hiPrio to override HIP's clinfo
|
(hiPrio clinfo) # hiPrio to override HIP's clinfo
|
||||||
binutils
|
binutils
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,15 @@ in {
|
||||||
};
|
};
|
||||||
enable = true;
|
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 = { };
|
users.groups.gamers = { };
|
||||||
|
|
||||||
|
|
@ -91,16 +100,10 @@ in {
|
||||||
MESA_GLSL_CACHE_DIR = "${XDG_CACHE_HOME}/mesa";
|
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 {
|
programs.steam.package = pkgs.steam.override {
|
||||||
extraPkgs = pkgs: [
|
extraPkgs = pkgs: [
|
||||||
config.programs.gamescope.package
|
pkgs.gamescope
|
||||||
];
|
];
|
||||||
#extraLibraries = pkgs: [
|
|
||||||
# config.programs.gamescope.package.override { enableExecutable = false; enableWsi = true; }
|
|
||||||
#];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
aviallon.programs.allowUnfreeList = [
|
aviallon.programs.allowUnfreeList = [
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ in {
|
||||||
yt-dlp
|
yt-dlp
|
||||||
jellyfin-media-player
|
jellyfin-media-player
|
||||||
|
|
||||||
#jamesdsp # Audio post-processing
|
jamesdsp # Audio post-processing
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.overlays = [(final: prev: {
|
nixpkgs.overlays = [(final: prev: {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
enableZenpower = (! isNull (builtins.match "znver[1-3]" generalCfg.cpu.arch)) && (versionOlder kernelVersion "6.13");
|
cpuIsZen = ! isNull (builtins.match "znver[0-9]" generalCfg.cpu.arch);
|
||||||
kernelVersion = getVersion config.boot.kernelPackages.kernel;
|
kernelVersion = getVersion config.boot.kernelPackages.kernel;
|
||||||
in {
|
in {
|
||||||
config = mkIf (generalCfg.cpu.vendor == "amd") {
|
config = mkIf (generalCfg.cpu.vendor == "amd") {
|
||||||
|
|
@ -27,18 +27,20 @@ in {
|
||||||
"amd_pstate.shared_memory" = 1;
|
"amd_pstate.shared_memory" = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
aviallon.boot.patches = mkIf config.aviallon.optimizations.enable {};
|
aviallon.boot.patches = mkIf config.aviallon.optimizations.enable {
|
||||||
|
amdClusterId.enable = mkIf cpuIsZen true;
|
||||||
|
};
|
||||||
|
|
||||||
boot.extraModulePackages = with config.boot.kernelPackages; []
|
boot.extraModulePackages = with config.boot.kernelPackages; []
|
||||||
++ optional enableZenpower (info "enable zenpower for Ryzen [1-3] CPU" zenpower)
|
++ optional cpuIsZen (info "enable zenpower for Ryzen CPU" zenpower)
|
||||||
;
|
;
|
||||||
|
|
||||||
boot.kernelModules = []
|
boot.kernelModules = []
|
||||||
++ optional enableZenpower "zenpower"
|
++ optional cpuIsZen "zenpower"
|
||||||
;
|
;
|
||||||
|
|
||||||
boot.blacklistedKernelModules = []
|
boot.blacklistedKernelModules = []
|
||||||
++ optional enableZenpower "k10-temp" # Superseded by zenpower
|
++ optional cpuIsZen "k10-temp" # Superseded by zenpower
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,26 +47,6 @@ in {
|
||||||
example = "gfx902";
|
example = "gfx902";
|
||||||
type = types.string;
|
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) {
|
config = mkIf (cfg.enable && localCfg.enable) {
|
||||||
|
|
@ -74,7 +54,7 @@ in {
|
||||||
[
|
[
|
||||||
rocmPackages.rocm-smi
|
rocmPackages.rocm-smi
|
||||||
#rocmPackages.meta.rocm-ml-libraries
|
#rocmPackages.meta.rocm-ml-libraries
|
||||||
#rocmPackages.meta.rocm-hip-runtime
|
rocmPackages.meta.rocm-hip-runtime
|
||||||
|
|
||||||
#pkgs.autoDetectGPU
|
#pkgs.autoDetectGPU
|
||||||
] ++ optionals devCfg.enable [
|
] ++ optionals devCfg.enable [
|
||||||
|
|
@ -106,20 +86,44 @@ in {
|
||||||
nixpkgs.config.rocmSupport = true;
|
nixpkgs.config.rocmSupport = true;
|
||||||
|
|
||||||
nixpkgs.overlays = mkBefore [(final: prev: {
|
nixpkgs.overlays = mkBefore [(final: prev: {
|
||||||
rocmPackages_5 = final.rocmPackages;
|
# Overlay Blender to use the HIP build if we have a compatible AMD GPU
|
||||||
rocmPackages = prev.rocmPackages // {
|
blender = final.blender-hip;
|
||||||
clr = prev.rocmPackages.clr.overrideAttrs (oldAttrs: {
|
blender-cpu = prev.blender;
|
||||||
passthru = oldAttrs.passthru // {
|
|
||||||
# We cannot use this for each ROCm library, as each defines their own supported targets
|
magma = final.magma-hip;
|
||||||
# See: https://github.com/ROCm/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix
|
magma-cpu = prev.magma;
|
||||||
gpuTargets = lib.forEach localCfg.gpuTargets (target: "gfx${target}");
|
|
||||||
};
|
#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=";
|
||||||
|
})
|
||||||
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
rocblas = prev.rocmPackages.rocblas.override {
|
rocblas = prev.hello;
|
||||||
gpuTargets = lib.forEach localCfg.gpuTargets (target: "gfx${target}");
|
|
||||||
|
rocmlir-rock = rocmlir.override {
|
||||||
|
buildRockCompiler = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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++";
|
||||||
|
'';
|
||||||
|
});
|
||||||
};
|
};
|
||||||
})];
|
})];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue