From aed273b46a14d992f273a2873db2239f659267fc Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Mon, 5 Feb 2024 23:03:46 +0100 Subject: [PATCH] Graphics module rather than Nvidia specific module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I❤ nvidia... --- flake.nix | 2 +- modules/graphics.nix | 31 +++++++++++++++++++++++++++++++ modules/nvidia.nix | 27 --------------------------- 3 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 modules/graphics.nix delete mode 100644 modules/nvidia.nix diff --git a/flake.nix b/flake.nix index 88294a1..d7e5767 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ ./modules/audio.nix ./modules/font.nix ./modules/nix-settings.nix - ./modules/nvidia.nix + ./modules/graphics.nix ./modules/services.nix ./modules/vim.nix ./modules/xconfig.nix diff --git a/modules/graphics.nix b/modules/graphics.nix new file mode 100644 index 0000000..04d340b --- /dev/null +++ b/modules/graphics.nix @@ -0,0 +1,31 @@ +{ lib, config, ... }: +with lib; +let cfg = config.voidcruiser.graphics; +in { + options.voidcruiser.graphics ={ + defaultSettings.enable = mkEnableOption "Enables some basic graphical settings"; + nvidia = { + enable = mkEnableOption "Enables Nvidia settings"; + proprietaryDrivers = mkEnableOption "Enables proprietary drivers"; + }; + }; + config = { + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + nvidia = mkIf cfg.nvidia.enable { + package = config.boot.kernelPackages.nvidiaPackages.stable; + powerManagement = { + enable = false; + finegrained = false; + }; + open = !cfg.nvidia.proprietaryDrivers; + nvidiaSettings = cfg.nvidia.proprietaryDrivers; + }; + }; + services.xserver.videoDrivers = mkIf cfg.nvidia.proprietaryDrivers ["nvidia"]; + }; +} diff --git a/modules/nvidia.nix b/modules/nvidia.nix deleted file mode 100644 index f9a87a9..0000000 --- a/modules/nvidia.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib, config, ... }: -with lib; -let cfg = config.voidcruiser.nvidia; -in { - options.voidcruiser.nvidia = { - enable = mkEnableOption "Enables proprietary Nvidia drivers and related config"; - }; - config = mkIf cfg.enable { - hardware = { - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; - nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.stable; - powerManagement = { - enable = false; - finegrained = false; - }; - open = false; - nvidiaSettings = true; - }; - }; - services.xserver.videoDrivers = ["nvidia"]; - }; -}