fix(gpu): add checks for session-specific options

This commit is contained in:
514fpv 2024-02-19 12:55:23 +08:00
parent 7e4d1afb5c
commit f2de94be1b
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
3 changed files with 12 additions and 7 deletions

View file

@ -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;

View file

@ -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" ];

View file

@ -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;