diff options
| author | seth <[email protected]> | 2024-06-30 09:56:30 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-06-30 10:23:04 -0400 |
| commit | 088facf700946cb8f2d96c6089185bdc2a67180a (patch) | |
| tree | c5b4e4cffbb3ee4ad2498c2251892bd457e9d3c7 /modules/nixos/traits/nvidia.nix | |
| parent | 5d3045a0769af3a94fba7b5cf646e8498aaef595 (diff) | |
alejandra -> nixfmt-rfc-style
Diffstat (limited to 'modules/nixos/traits/nvidia.nix')
| -rw-r--r-- | modules/nixos/traits/nvidia.nix | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/modules/nixos/traits/nvidia.nix b/modules/nixos/traits/nvidia.nix index 303d902..5fec7db 100644 --- a/modules/nixos/traits/nvidia.nix +++ b/modules/nixos/traits/nvidia.nix @@ -3,49 +3,53 @@ lib, pkgs, ... -}: let +}: +let cfg = config.traits.nvidia; usingNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers; -in { +in +{ options.traits.nvidia = { enable = lib.mkEnableOption "NVIDIA drivers"; nvk.enable = lib.mkEnableOption "NVK specialisation"; }; - config = lib.mkIf cfg.enable (lib.mkMerge [ - { - boot.kernelParams = lib.optional usingNvidia "nvidia_drm.fbdev=1"; + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + boot.kernelParams = lib.optional usingNvidia "nvidia_drm.fbdev=1"; - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; - hardware = { - graphics.extraPackages = [pkgs.vaapiVdpau]; - nvidia = { - package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.latest; - modesetting.enable = true; - }; - }; - } - - (lib.mkIf cfg.nvk.enable { - specialisation = { - nvk.configuration = { - boot = { - kernelParams = ["nouveau.config=NvGspRm=1"]; - initrd.kernelModules = ["nouveau"]; + hardware = { + graphics.extraPackages = [ pkgs.vaapiVdpau ]; + nvidia = { + package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.latest; + modesetting.enable = true; }; + }; + } - environment.sessionVariables = { - MESA_VK_VERSION_OVERRIDE = "1.3"; - }; + (lib.mkIf cfg.nvk.enable { + specialisation = { + nvk.configuration = { + boot = { + kernelParams = [ "nouveau.config=NvGspRm=1" ]; + initrd.kernelModules = [ "nouveau" ]; + }; + + environment.sessionVariables = { + MESA_VK_VERSION_OVERRIDE = "1.3"; + }; - hardware.graphics.extraPackages = lib.mkForce []; + hardware.graphics.extraPackages = lib.mkForce [ ]; - services.xserver.videoDrivers = lib.mkForce ["modesetting"]; + services.xserver.videoDrivers = lib.mkForce [ "modesetting" ]; - system.nixos.tags = ["with-nvk"]; + system.nixos.tags = [ "with-nvk" ]; + }; }; - }; - }) - ]); + }) + ] + ); } |
