mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-26 18:08:28 +02:00
fix: user environment variables do not take effects
This commit is contained in:
@@ -10,11 +10,18 @@ in {
|
||||
nvidia = mkEnableOption "whether nvidia GPU is used";
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && cfg.nvidia) {
|
||||
systemd.user.sessionVariables = {
|
||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||
"GBM_BACKEND" = "nvidia-drm";
|
||||
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
||||
};
|
||||
};
|
||||
config = mkIf (cfg.enable && cfg.nvidia) (
|
||||
let
|
||||
env = {
|
||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||
"GBM_BACKEND" = "nvidia-drm";
|
||||
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
||||
};
|
||||
in {
|
||||
# environment set for systemd's user session
|
||||
systemd.user.sessionVariables = env;
|
||||
# environment set at user login
|
||||
home.sessionVariables = env;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user