mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-23 09:18:35 +02:00
feat: environment variables for wayland & nvidia
This commit is contained in:
@@ -6,8 +6,25 @@
|
||||
{
|
||||
imports = [
|
||||
./anyrun.nix
|
||||
./nvidia.nix
|
||||
];
|
||||
|
||||
# wayland related
|
||||
home.sessionVariables = {
|
||||
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
|
||||
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
|
||||
"MOZ_WEBRENDER" = "1";
|
||||
# enable native Wayland support for most Electron apps
|
||||
"ELECTRON_OZONE_PLATFORM_HINT" = "auto";
|
||||
# misc
|
||||
"_JAVA_AWT_WM_NONREPARENTING" = "1";
|
||||
"QT_WAYLAND_DISABLE_WINDOWDECORATION" = "1";
|
||||
"QT_QPA_PLATFORM" = "wayland";
|
||||
"SDL_VIDEODRIVER" = "wayland";
|
||||
"GDK_BACKEND" = "wayland";
|
||||
"XDG_SESSION_TYPE" = "wayland";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
swaybg # the wallpaper
|
||||
wl-clipboard # copying and pasting
|
||||
|
||||
26
home/linux/gui/base/desktop/nvidia.nix
Normal file
26
home/linux/gui/base/desktop/nvidia.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.desktop.nvidia;
|
||||
in
|
||||
{
|
||||
options.modules.desktop.nvidia = {
|
||||
enable = mkEnableOption "whether nvidia GPU is used";
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && cfg.enable) {
|
||||
home.sessionVariables = {
|
||||
# for hyprland with nvidia gpu" = " ref https://wiki.hyprland.org/Nvidia/
|
||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
||||
# VA-API hardware video acceleration
|
||||
"NVD_BACKEND" = "direct";
|
||||
|
||||
"GBM_BACKEND" = "nvidia-drm";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user