mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 10:18:37 +02:00
fix: user environment variables do not take effects
This commit is contained in:
@@ -7,8 +7,8 @@ in rec {
|
|||||||
|
|
||||||
home.homeDirectory = "/home/${username}";
|
home.homeDirectory = "/home/${username}";
|
||||||
|
|
||||||
# add environment variables
|
# environment variables that always set at login
|
||||||
systemd.user.sessionVariables = {
|
home.sessionVariables = {
|
||||||
# clean up ~
|
# clean up ~
|
||||||
LESSHISTFILE = cache + "/less/history";
|
LESSHISTFILE = cache + "/less/history";
|
||||||
LESSKEY = c + "/less/lesskey";
|
LESSKEY = c + "/less/lesskey";
|
||||||
@@ -25,6 +25,4 @@ in rec {
|
|||||||
# enable scrolling in git diff
|
# enable scrolling in git diff
|
||||||
DELTA_PAGER = "less -R";
|
DELTA_PAGER = "less -R";
|
||||||
};
|
};
|
||||||
|
|
||||||
home.sessionVariables = systemd.user.sessionVariables;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.enable && cfg.nvidia) {
|
config = mkIf (cfg.enable && cfg.nvidia) {
|
||||||
systemd.user.sessionVariables = {
|
wayland.windowManager.hyprland.settings.env = [
|
||||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
"LIBVA_DRIVER_NAME,nvidia"
|
||||||
"XDG_SESSION_TYPE" = "wayland";
|
"XDG_SESSION_TYPE,wayland"
|
||||||
"GBM_BACKEND" = "nvidia-drm";
|
"GBM_BACKEND,nvidia-drm"
|
||||||
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
|
||||||
# fix https://github.com/hyprwm/Hyprland/issues/1520
|
# fix https://github.com/hyprwm/Hyprland/issues/1520
|
||||||
"WLR_NO_HARDWARE_CURSORS" = "1";
|
"WLR_NO_HARDWARE_CURSORS,1"
|
||||||
};
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf";
|
source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf";
|
||||||
|
env = [
|
||||||
|
"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"
|
||||||
|
# misc
|
||||||
|
"_JAVA_AWT_WM_NONREPARENTING,1"
|
||||||
|
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
package = hyprland.packages.${pkgs.system}.hyprland;
|
package = hyprland.packages.${pkgs.system}.hyprland;
|
||||||
extraConfig = builtins.readFile ../conf/hyprland.conf;
|
extraConfig = builtins.readFile ../conf/hyprland.conf;
|
||||||
@@ -55,13 +63,4 @@
|
|||||||
|
|
||||||
# allow fontconfig to discover fonts and configurations installed through home.packages
|
# allow fontconfig to discover fonts and configurations installed through home.packages
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
|
|
||||||
systemd.user.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";
|
|
||||||
# misc
|
|
||||||
_JAVA_AWT_WM_NONREPARENTING = "1";
|
|
||||||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,18 @@ in {
|
|||||||
nvidia = mkEnableOption "whether nvidia GPU is used";
|
nvidia = mkEnableOption "whether nvidia GPU is used";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.enable && cfg.nvidia) {
|
config = mkIf (cfg.enable && cfg.nvidia) (
|
||||||
systemd.user.sessionVariables = {
|
let
|
||||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
env = {
|
||||||
"GBM_BACKEND" = "nvidia-drm";
|
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||||
"__GLX_VENDOR_LIBRARY_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