forked from pub-solar/os
Clean some sessionVariables from global scope
Especially some XDG_* env vars polluted other users environment when set globally
This commit is contained in:
parent
a795bf4429
commit
1f2ba895a0
|
@ -28,16 +28,17 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
ack
|
||||||
|
bat
|
||||||
|
exa
|
||||||
|
fd
|
||||||
|
neovim
|
||||||
screen
|
screen
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
ack
|
|
||||||
asciinema
|
asciinema
|
||||||
bat
|
|
||||||
exa
|
|
||||||
fd
|
|
||||||
gh
|
gh
|
||||||
glow
|
glow
|
||||||
nnn
|
nnn
|
||||||
|
|
|
@ -3,7 +3,14 @@ let
|
||||||
psCfg = config.pub-solar;
|
psCfg = config.pub-solar;
|
||||||
wlroots = psCfg.graphical.wayland;
|
wlroots = psCfg.graphical.wayland;
|
||||||
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
||||||
variables = {
|
globalVariables = {
|
||||||
|
EDITOR = "/run/current-system/sw/bin/nvim";
|
||||||
|
VISUAL = "/run/current-system/sw/bin/nvim";
|
||||||
|
|
||||||
|
# Make sure virsh runs without root
|
||||||
|
LIBVIRT_DEFAULT_URI = "qemu:///system";
|
||||||
|
};
|
||||||
|
userVariables = {
|
||||||
XDG_CONFIG_HOME = xdg.configHome;
|
XDG_CONFIG_HOME = xdg.configHome;
|
||||||
XDG_CACHE_HOME = xdg.cacheHome;
|
XDG_CACHE_HOME = xdg.cacheHome;
|
||||||
XDG_DATA_HOME = xdg.dataHome;
|
XDG_DATA_HOME = xdg.dataHome;
|
||||||
|
@ -18,11 +25,8 @@ let
|
||||||
SDL_VIDEODRIVER = "wayland";
|
SDL_VIDEODRIVER = "wayland";
|
||||||
WLR_RENDERER = if wlroots.software-renderer.enable then "pixman" else "gles2";
|
WLR_RENDERER = if wlroots.software-renderer.enable then "pixman" else "gles2";
|
||||||
|
|
||||||
EDITOR = "/etc/profiles/per-user/${psCfg.user.name}/bin/nvim";
|
|
||||||
VISUAL = "/etc/profiles/per-user/${psCfg.user.name}/bin/nvim";
|
|
||||||
|
|
||||||
# fix "xdg-open fork-bomb" your preferred browser from here
|
# fix "xdg-open fork-bomb" your preferred browser from here
|
||||||
BROWSER = "${pkgs.firefox-wayland}/bin/firefox";
|
BROWSER = "firefox";
|
||||||
|
|
||||||
# node
|
# node
|
||||||
NODE_REPL_HISTORY = "${xdg.dataHome}/node_repl_history";
|
NODE_REPL_HISTORY = "${xdg.dataHome}/node_repl_history";
|
||||||
|
@ -34,9 +38,6 @@ let
|
||||||
NPM_CONFIG_CACHE = "${xdg.configHome}/npm";
|
NPM_CONFIG_CACHE = "${xdg.configHome}/npm";
|
||||||
# TODO: used to be XDG_RUNTIME_DIR NPM_CONFIG_TMP = "/tmp/npm";
|
# TODO: used to be XDG_RUNTIME_DIR NPM_CONFIG_TMP = "/tmp/npm";
|
||||||
|
|
||||||
# Make sure virsh runs without root
|
|
||||||
LIBVIRT_DEFAULT_URI = "qemu:///system";
|
|
||||||
|
|
||||||
# wine
|
# wine
|
||||||
WINEPREFIX = "${xdg.dataHome}/wineprefixes/default";
|
WINEPREFIX = "${xdg.dataHome}/wineprefixes/default";
|
||||||
|
|
||||||
|
@ -78,21 +79,21 @@ let
|
||||||
VUEDX_TELEMETRY = "off";
|
VUEDX_TELEMETRY = "off";
|
||||||
};
|
};
|
||||||
|
|
||||||
envListNames = lib.attrsets.mapAttrsToList (name: value: name) variables;
|
envListNames = lib.attrsets.mapAttrsToList (name: value: name) userVariables;
|
||||||
|
|
||||||
# Here we merge an extra variable into the attrset called FULL_ENV_LIST.
|
# Here we merge an extra variable into the attrset called FULL_ENV_LIST.
|
||||||
# It's a list of the variable names defined above.
|
# It's a list of the variable names defined above.
|
||||||
# We can use this to tell `systemctl import-environment` to import the full list above.
|
# We can use this to tell `systemctl import-environment` to import the full list above.
|
||||||
variablesWithMeta = lib.attrsets.zipAttrsWith (name: values: builtins.head values) [
|
userVariablesWithMeta = lib.attrsets.zipAttrsWith (name: values: builtins.head values) [
|
||||||
variables
|
userVariables
|
||||||
{ IMPORT_ENVIRONMENT_ENV_LIST = lib.lists.foldl (a: b: a + " " + b) "IMPORT_ENVIRONMENT_ENV_LIST" envListNames; }
|
{ IMPORT_ENVIRONMENT_ENV_LIST = lib.lists.foldl (a: b: a + " " + b) "IMPORT_ENVIRONMENT_ENV_LIST" envListNames; }
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
||||||
home.sessionVariables = variablesWithMeta;
|
home.sessionVariables = userVariablesWithMeta;
|
||||||
systemd.user.sessionVariables = variablesWithMeta;
|
systemd.user.sessionVariables = userVariablesWithMeta;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.variables = variablesWithMeta;
|
environment.variables = globalVariables;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue