2022-08-24 22:13:23 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
2021-05-30 19:10:28 +00:00
|
|
|
let
|
|
|
|
psCfg = config.pub-solar;
|
2022-02-03 01:47:00 +00:00
|
|
|
wlroots = psCfg.graphical.wayland;
|
2021-05-30 19:10:28 +00:00
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
2022-11-27 20:57:34 +00:00
|
|
|
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 = {
|
2021-05-30 19:10:28 +00:00
|
|
|
XDG_CONFIG_HOME = xdg.configHome;
|
|
|
|
XDG_CACHE_HOME = xdg.cacheHome;
|
|
|
|
XDG_DATA_HOME = xdg.dataHome;
|
|
|
|
|
|
|
|
XDG_CURRENT_DESKTOP = "sway";
|
|
|
|
|
|
|
|
QT_QPA_PLATFORM = "wayland";
|
|
|
|
|
|
|
|
# Wayland fixes
|
|
|
|
ECORE_EVAS_ENGINE = "wayland_egl";
|
|
|
|
ELM_ENGINE = "wayland_egl";
|
|
|
|
SDL_VIDEODRIVER = "wayland";
|
2022-02-03 01:47:00 +00:00
|
|
|
WLR_RENDERER = if wlroots.software-renderer.enable then "pixman" else "gles2";
|
2021-05-30 19:10:28 +00:00
|
|
|
|
|
|
|
# fix "xdg-open fork-bomb" your preferred browser from here
|
2022-11-27 20:57:34 +00:00
|
|
|
BROWSER = "firefox";
|
2021-05-30 19:10:28 +00:00
|
|
|
|
|
|
|
# node
|
|
|
|
NODE_REPL_HISTORY = "${xdg.dataHome}/node_repl_history";
|
|
|
|
NVM_DIR = "${xdg.dataHome}/nvm";
|
|
|
|
PKG_CACHE_PATH = "${xdg.cacheHome}/pkg-cache";
|
|
|
|
|
|
|
|
# npm
|
|
|
|
NPM_CONFIG_USERCONFIG = "${xdg.configHome}/npm/config";
|
|
|
|
NPM_CONFIG_CACHE = "${xdg.configHome}/npm";
|
|
|
|
# TODO: used to be XDG_RUNTIME_DIR NPM_CONFIG_TMP = "/tmp/npm";
|
|
|
|
|
|
|
|
# wine
|
|
|
|
WINEPREFIX = "${xdg.dataHome}/wineprefixes/default";
|
|
|
|
|
|
|
|
# z
|
|
|
|
_Z_DATA = "${xdg.dataHome}/z";
|
|
|
|
|
|
|
|
# wget
|
|
|
|
WGETRC = "${xdg.configHome}/wgetrc";
|
|
|
|
|
|
|
|
# rust
|
|
|
|
RUSTUP_HOME = "${xdg.dataHome}/rustup";
|
|
|
|
CARGO_HOME = "${xdg.dataHome}/cargo";
|
|
|
|
|
|
|
|
# Java
|
2021-11-15 10:37:56 +00:00
|
|
|
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot='${xdg.configHome}/java'";
|
2021-05-30 19:10:28 +00:00
|
|
|
_JAVA_AWT_WM_NONREPARENTING = "1";
|
|
|
|
|
|
|
|
# docker
|
|
|
|
DOCKER_CONFIG = "${xdg.configHome}/docker";
|
|
|
|
|
|
|
|
# experimental wayland in firefox/thunderbird
|
|
|
|
MOZ_ENABLE_WAYLAND = "1";
|
|
|
|
|
2022-01-31 16:09:49 +00:00
|
|
|
# chromium / electron on wayland: enable ozone (native wayland mode)
|
|
|
|
NIXOS_OZONE_WL = "1";
|
|
|
|
|
2021-05-30 19:10:28 +00:00
|
|
|
# Vagrant
|
|
|
|
VAGRANT_HOME = "${xdg.dataHome}/vagrant";
|
|
|
|
VAGRANT_DEFAULT_PROVIDER = "libvirt";
|
|
|
|
|
|
|
|
# Android
|
|
|
|
ANDROID_SDK_ROOT = "${xdg.configHome}/android";
|
|
|
|
|
|
|
|
ANDROID_AVD_HOME = "${xdg.dataHome}/android";
|
|
|
|
ANDROID_EMULATOR_HOME = "${xdg.dataHome}/android";
|
|
|
|
ADB_VENDOR_KEY = "${xdg.configHome}/android";
|
|
|
|
|
|
|
|
# TELEMETRY BS
|
|
|
|
VUEDX_TELEMETRY = "off";
|
|
|
|
};
|
2022-08-24 22:13:23 +00:00
|
|
|
|
2022-11-27 20:57:34 +00:00
|
|
|
envListNames = lib.attrsets.mapAttrsToList (name: value: name) userVariables;
|
2022-08-24 22:13:23 +00:00
|
|
|
|
|
|
|
# Here we merge an extra variable into the attrset called FULL_ENV_LIST.
|
|
|
|
# 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.
|
2022-11-27 20:57:34 +00:00
|
|
|
userVariablesWithMeta = lib.attrsets.zipAttrsWith (name: values: builtins.head values) [
|
|
|
|
userVariables
|
2022-08-24 22:13:23 +00:00
|
|
|
{ IMPORT_ENVIRONMENT_ENV_LIST = lib.lists.foldl (a: b: a + " " + b) "IMPORT_ENVIRONMENT_ENV_LIST" envListNames; }
|
|
|
|
];
|
2021-05-30 19:10:28 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
2022-11-27 20:57:34 +00:00
|
|
|
home.sessionVariables = userVariablesWithMeta;
|
|
|
|
systemd.user.sessionVariables = userVariablesWithMeta;
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
2022-08-24 22:13:23 +00:00
|
|
|
|
2022-11-27 20:57:34 +00:00
|
|
|
environment.variables = globalVariables;
|
2021-05-30 19:10:28 +00:00
|
|
|
}
|