Files

48 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
osConfig,
...
}:
let
home = config.home.homeDirectory;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
runtimeDir = "/run/user/${toString osConfig.users.users.${config.home.username}.uid}";
vars = {
XDG_CACHE_HOME = "${home}/.cache";
XDG_CONFIG_HOME = "${home}/.config";
XDG_DATA_HOME = "${home}/.local/share";
XDG_STATE_HOME = "${home}/.local/state";
ANDROID_USER_HOME = "${home}/.local/share/android";
AZURE_CONFIG_DIR = "${home}/.local/share/azure";
NPM_CONFIG_INIT_MODULE = "${home}/.config/npm/config/npm-init.js";
NPM_CONFIG_CACHE = "${home}/.cache/npm";
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${home}/.config/java";
PYTHON_HISTORY = "${home}/.local/state/python_history";
HISTFILE = "${home}/.local/state/bash/history";
DOTNET_ROOT = "${pkgs.dotnet-sdk}/share/dotnet";
DOTNET_CLI_HOME = "${home}/.local/share/dotnet";
GTK2_RC_FILES = "${home}/.config/gtk-2.0/gtkrc";
WINEPREFIX = "${home}/.local/share/wine";
};
linuxVars = {
NPM_CONFIG_TMP = "${runtimeDir}/npm";
};
in
{
home.sessionVariables = vars // lib.optionalAttrs isLinux linuxVars;
systemd.user.sessionVariables = lib.mkIf isLinux (vars // linuxVars);
}