From f2de94be1b64c8a70729654a54e56fe7f0b379ac Mon Sep 17 00:00:00 2001 From: 514fpv Date: Mon, 19 Feb 2024 12:55:23 +0800 Subject: [PATCH] fix(gpu): add checks for session-specific options --- global/gpu/default.nix | 13 ++++++++----- global/gpu/greetd.nix | 3 ++- global/gpu/plymouth.nix | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/global/gpu/default.nix b/global/gpu/default.nix index 24c84b9e..1980ad8d 100644 --- a/global/gpu/default.nix +++ b/global/gpu/default.nix @@ -46,11 +46,14 @@ in { optional (cfg.type == "nvidia") vulkan-validation-layers; }; - services.xserver.videoDrivers = - optional nvidia "nvidia" ++ - optional (cfg.type == "amdgpu") "amdgpu"; - # inhibits default display manager - services.xserver.displayManager.startx.enable = mkDefault true; + services.xserver = mkIf cfg.session { + videoDrivers = + optional nvidia "nvidia" ++ + optional (cfg.type == "amdgpu") "amdgpu"; + # inhibits default display manager + + displayManager.startx.enable = mkDefault true; + }; hardware.nvidia = mkIf nvidia { modesetting.enable = true; diff --git a/global/gpu/greetd.nix b/global/gpu/greetd.nix index 17dc4e9e..d31f6c5c 100644 --- a/global/gpu/greetd.nix +++ b/global/gpu/greetd.nix @@ -3,7 +3,8 @@ , config , ... }: with lib; let cfg = config.global.gpu; -in mkIf (cfg.enable && cfg.session) { + gui = with cfg; enable && session; +in mkIf gui { programs.regreet = { enable = mkDefault true; cageArgs = [ "-s" "-d" "-m" "last" ]; diff --git a/global/gpu/plymouth.nix b/global/gpu/plymouth.nix index 2d7f7404..0705fd8a 100644 --- a/global/gpu/plymouth.nix +++ b/global/gpu/plymouth.nix @@ -3,7 +3,8 @@ , config , ... }: with lib; let cfg = config.global.gpu; -in mkIf cfg.enable { + gui = with cfg; enable && session; +in mkIf gui { boot = { loader.timeout = mkDefault 0; consoleLogLevel = 0;