From 3d8f4906724f4585e89f21a7820fa9fdab97196e Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 14:46:33 +0200 Subject: [PATCH] flake: move grapics settings into graphics.nix --- modules/options/system/hardware.nix | 10 --------- modules/options/system/module.nix | 2 -- modules/system/hardware/graphics.nix | 33 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 modules/options/system/hardware.nix diff --git a/modules/options/system/hardware.nix b/modules/options/system/hardware.nix deleted file mode 100644 index 6fc8b87..0000000 --- a/modules/options/system/hardware.nix +++ /dev/null @@ -1,10 +0,0 @@ -{lib, ...}: let - inherit (lib) mkOption mkEnableOption; -in { - options.modules.system.hardware = { - nvidia = { - enable = mkEnableOption "Nvidia Nvidia graphics drivers"; - }; - amd.enable = mkEnableOption "AMD graphics drivers"; - }; -} diff --git a/modules/options/system/module.nix b/modules/options/system/module.nix index 51c2c46..bce1197 100644 --- a/modules/options/system/module.nix +++ b/modules/options/system/module.nix @@ -29,8 +29,6 @@ in { # monitor configuration ./monitors.nix - - ./hardware.nix ]; options.modules.system = { diff --git a/modules/system/hardware/graphics.nix b/modules/system/hardware/graphics.nix index dae0ada..25e255e 100644 --- a/modules/system/hardware/graphics.nix +++ b/modules/system/hardware/graphics.nix @@ -1,38 +1,37 @@ { config, lib, - pkgs, ... }: let + inherit (lib.modules) mkIf; + inherit (lib.options) mkEnableOption; + cfg = config.modules.system.hardware; - inherit (lib) mkIf; - inherit (lib.modules) mkForce; in { + options.modules.system.hardware = { + nvidia = { + enable = mkEnableOption "Nvidia graphics drivers"; + }; + amd.enable = mkEnableOption "AMD graphics drivers"; + }; config = { hardware = { - graphics = { - enable = true; - extraPackages = mkIf cfg.amd.enable (builtins.attrValues { - inherit - (pkgs) - mesa - libva - vaapiVdpa - ; - }); - }; + graphics.enable = true; nvidia = mkIf cfg.nvidia.enable { + # we want the open-source drivers + open = true; + modesetting.enable = true; - open = mkForce true; + nvidiaSettings = false; + + # fixes sleep on nvidia devices powerManagement = { enable = true; finegrained = false; }; - nvidiaSettings = false; package = config.boot.kernelPackages.nvidiaPackages.beta; }; }; - boot.initrd.kernelModules = mkIf cfg.amd.enable ["amdgpu"]; services.xserver.videoDrivers = mkIf cfg.nvidia.enable ["nvidia"]; }; }