From 043ba21e98eaf376e6933f07d45ddd8c31d98f9d Mon Sep 17 00:00:00 2001 From: reidlab Date: Thu, 14 May 2026 19:21:21 -0700 Subject: [PATCH] slight refactor/rocm packages --- flake.nix | 22 +++++++++------------- lib/nixos.nix | 5 ++--- modules/hardware/graphics/amdgpu.nix | 5 +++++ modules/hardware/graphics/i915.nix | 2 ++ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/flake.nix b/flake.nix index ca1312a..9bc015d 100644 --- a/flake.nix +++ b/flake.nix @@ -49,22 +49,18 @@ }; }); - mkPkgs = system: pkgs: extraOverlays: - import pkgs { - inherit system; - config.allowUnfree = true; - config.allowAliases = true; - overlays = extraOverlays ++ (lib.attrValues self.overlays); - }; - - pkgsFor = eachSystem (system: - mkPkgs system nixpkgs [ + commonNixpkgsConfig = { + config.allowUnfree = true; + config.allowAliases = true; + overlays = [ self.overlays.default inputs.cachyos-kernel.overlays.pinned inputs.niri.overlays.niri inputs.nix-vscode-extensions.overlays.default - ] - ); + ] ++ (lib.attrValues self.overlays); + }; + + pkgsFor = eachSystem (system: import nixpkgs ({ inherit system; } // commonNixpkgsConfig)); in { lib = lib.my; @@ -82,6 +78,6 @@ nixosModules = mapModulesRec ./modules import; - nixosConfigurations = mapHosts ./hosts { inherit pkgsFor; }; + nixosConfigurations = mapHosts ./hosts { inherit commonNixpkgsConfig; }; }; } diff --git a/lib/nixos.nix b/lib/nixos.nix index af1c8c1..ff456da 100755 --- a/lib/nixos.nix +++ b/lib/nixos.nix @@ -11,7 +11,7 @@ in rec { mkHost = path: { system, - pkgsFor, + commonNixpkgsConfig, ... }: nixosSystem { @@ -21,8 +21,7 @@ in rec { modules = [ { - nixpkgs.pkgs = pkgsFor.${system}; - nixpkgs.hostPlatform = lib.mkDefault system; + nixpkgs = commonNixpkgsConfig // { hostPlatform = lib.mkDefault system; }; networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path)); } diff --git a/modules/hardware/graphics/amdgpu.nix b/modules/hardware/graphics/amdgpu.nix index 4ea5302..4c4af3a 100644 --- a/modules/hardware/graphics/amdgpu.nix +++ b/modules/hardware/graphics/amdgpu.nix @@ -10,10 +10,15 @@ in { }; config = mkIf cfg.enable { + # opencl hardware.amdgpu.opencl.enable = true; + nixpkgs.config.rocmSupport = true; + + # oc hardware.amdgpu.overdrive.enable = cfg.overclock; services.lact.enable = cfg.overclock; + # top environment.systemPackages = with pkgs; [ amdgpu_top ]; # radv > amdvlk diff --git a/modules/hardware/graphics/i915.nix b/modules/hardware/graphics/i915.nix index 90345e2..62f1543 100644 --- a/modules/hardware/graphics/i915.nix +++ b/modules/hardware/graphics/i915.nix @@ -13,12 +13,14 @@ in { }; config = mkIf cfg.enable { + # top environment.systemPackages = with pkgs; [ intel-gpu-tools ]; hardware.intel-gpu-tools.enable = true; boot.kernelParams = [ # enable gpu virtualization "i915.enable_gvt=1" + # explicitly enable power saving options (framebuffer compression) ] ++ optional cfg.powersave "i915.enable_fbc=1"; }; }