mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
Compare commits
12 commits
bb6167236a
...
d38185f994
| Author | SHA1 | Date | |
|---|---|---|---|
| d38185f994 | |||
| 8f5ac9487e | |||
| 124f0a34c7 | |||
| e8b457bc1c | |||
| bd7ae5346e | |||
| 0fea61e5a1 | |||
| 413a4a93f1 | |||
| ed142942db | |||
| 1dcf6ec9b3 | |||
| c2eef29a53 | |||
| 9c2853288f | |||
| bfd637707c |
6 changed files with 65 additions and 80 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;
|
||||||
extraConfig = ''
|
extraConfigStructuredConfig = with lib.kernel; {
|
||||||
RT_GROUP_SCHED y
|
RT_GROUP_SCHED = yes;
|
||||||
'';
|
};
|
||||||
};
|
};
|
||||||
enableEnergyModel = {
|
enableEnergyModel = {
|
||||||
name = "enable-energy-model";
|
name = "enable-energy-model";
|
||||||
patch = null; extraConfig = ''
|
patch = null; extraStructuredConfig = with lib.kernel; {
|
||||||
ENERGY_MODEL y
|
ENERGY_MODEL = yes;
|
||||||
'';
|
};
|
||||||
};
|
};
|
||||||
removeKernelDRM = {
|
removeKernelDRM = {
|
||||||
name = "remove-kernel-drm";
|
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 = {
|
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
|
||||||
|
|
@ -150,7 +133,6 @@ 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 {
|
||||||
|
|
@ -316,16 +298,25 @@ in {
|
||||||
else
|
else
|
||||||
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,6 +53,9 @@ 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,15 +70,6 @@ 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 = { };
|
||||||
|
|
||||||
|
|
@ -100,10 +91,16 @@ 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: [
|
||||||
pkgs.gamescope
|
config.programs.gamescope.package
|
||||||
];
|
];
|
||||||
|
#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;
|
||||||
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;
|
kernelVersion = getVersion config.boot.kernelPackages.kernel;
|
||||||
in {
|
in {
|
||||||
config = mkIf (generalCfg.cpu.vendor == "amd") {
|
config = mkIf (generalCfg.cpu.vendor == "amd") {
|
||||||
|
|
@ -27,20 +27,18 @@ 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 cpuIsZen (info "enable zenpower for Ryzen CPU" zenpower)
|
++ optional enableZenpower (info "enable zenpower for Ryzen [1-3] CPU" zenpower)
|
||||||
;
|
;
|
||||||
|
|
||||||
boot.kernelModules = []
|
boot.kernelModules = []
|
||||||
++ optional cpuIsZen "zenpower"
|
++ optional enableZenpower "zenpower"
|
||||||
;
|
;
|
||||||
|
|
||||||
boot.blacklistedKernelModules = []
|
boot.blacklistedKernelModules = []
|
||||||
++ optional cpuIsZen "k10-temp" # Superseded by zenpower
|
++ optional enableZenpower "k10-temp" # Superseded by zenpower
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,26 @@ 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) {
|
||||||
|
|
@ -54,7 +74,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 [
|
||||||
|
|
@ -86,44 +106,20 @@ in {
|
||||||
nixpkgs.config.rocmSupport = true;
|
nixpkgs.config.rocmSupport = true;
|
||||||
|
|
||||||
nixpkgs.overlays = mkBefore [(final: prev: {
|
nixpkgs.overlays = mkBefore [(final: prev: {
|
||||||
# Overlay Blender to use the HIP build if we have a compatible AMD GPU
|
rocmPackages_5 = final.rocmPackages;
|
||||||
blender = final.blender-hip;
|
rocmPackages = prev.rocmPackages // {
|
||||||
blender-cpu = prev.blender;
|
clr = prev.rocmPackages.clr.overrideAttrs (oldAttrs: {
|
||||||
|
passthru = oldAttrs.passthru // {
|
||||||
magma = final.magma-hip;
|
# We cannot use this for each ROCm library, as each defines their own supported targets
|
||||||
magma-cpu = prev.magma;
|
# See: https://github.com/ROCm/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix
|
||||||
|
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.hello;
|
rocblas = prev.rocmPackages.rocblas.override {
|
||||||
|
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