massively improve xdg config readability

This commit is contained in:
jacekpoz 2024-11-01 23:15:39 +01:00
parent abb6013f3e
commit b09cc18752
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -3,7 +3,6 @@
...
}: let
inherit (config.poz.other.system) username;
hmCfg = config.home-manager.users.${username};
# https://specifications.freedesktop.org/basedir-spec/latest/
XDG_CACHE_HOME = "$HOME/.cache";
@ -20,39 +19,39 @@ in {
XDG_STATE_HOME
;
ANDROID_HOME = "${hmCfg.xdg.dataHome}/android";
CARGO_HOME = "${hmCfg.xdg.dataHome}/cargo";
DOTNET_CLI_HOME = "${hmCfg.xdg.dataHome}/dotnet";
GOPATH = "${hmCfg.xdg.dataHome}/go";
GNUPGHOME = "${hmCfg.xdg.dataHome}/gnupg";
GRADLE_USER_HOME = "${hmCfg.xdg.dataHome}/gradle";
HISTFILE = "${hmCfg.xdg.stateHome}/bash/history";
MYSQL_HISTFILE = "${hmCfg.xdg.stateHome}/mysql/history";
NPM_CONFIG_USERCONFIG = "${hmCfg.xdg.configHome}/npm/npmrc";
NUGET_PACKAGES = "${hmCfg.xdg.cacheHome}/NuGetPackages";
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${hmCfg.xdg.configHome}/java";
PARALLEL_HOME = "${hmCfg.xdg.configHome}/parallel";
PYTHONSTARTUP = "${hmCfg.xdg.configHome}/python/pythonrc";
RUSTUP_HOME = "${hmCfg.xdg.dataHome}/rustup";
WINEPREFIX = "${hmCfg.xdg.dataHome}/wine";
ANDROID_HOME = "${XDG_DATA_HOME}/android";
CARGO_HOME = "${XDG_DATA_HOME}/cargo";
DOTNET_CLI_HOME = "${XDG_DATA_HOME}/dotnet";
GOPATH = "${XDG_DATA_HOME}/go";
GNUPGHOME = "${XDG_DATA_HOME}/gnupg";
GRADLE_USER_HOME = "${XDG_DATA_HOME}/gradle";
HISTFILE = "${XDG_STATE_HOME}/bash/history";
MYSQL_HISTFILE = "${XDG_STATE_HOME}/mysql/history";
NPM_CONFIG_USERCONFIG = "${XDG_CONFIG_HOME}/npm/npmrc";
NUGET_PACKAGES = "${XDG_CACHE_HOME}/NuGetPackages";
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java";
PARALLEL_HOME = "${XDG_CONFIG_HOME}/parallel";
PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc";
RUSTUP_HOME = "${XDG_DATA_HOME}/rustup";
WINEPREFIX = "${XDG_DATA_HOME}/wine";
XAUTHORITY = "\$XDG_RUNTIME_DIR/Xauthority";
};
poz.programs.zsh.extraAliases = {
gdb = "gdb -n -x ${hmCfg.xdg.configHome}/gdb/init";
pidgin = "pidgin --config=${hmCfg.xdg.dataHome}/purple";
svn = "svn --config-dir ${hmCfg.xdg.configHome}/subversion";
wget = "wget --hsts-file=\"${hmCfg.xdg.dataHome}/wget-hsts\"";
gdb = "gdb -n -x ${XDG_CONFIG_HOME}/gdb/init";
pidgin = "pidgin --config=${XDG_DATA_HOME}/purple";
svn = "svn --config-dir ${XDG_CONFIG_HOME}/subversion";
wget = "wget --hsts-file=\"${XDG_DATA_HOME}/wget-hsts\"";
};
home-manager.users.${username} = {
xdg = {
configFile = {
"npm/npmrc".text = ''
prefix=${hmCfg.xdg.dataHome}/npm
cache=${hmCfg.xdg.cacheHome}/npm
prefix=${XDG_DATA_HOME}/npm
cache=${XDG_CACHE_HOME}/npm
tmp=\$XDG_RUNTIME_DIR/npm
init-module=${hmCfg.xdg.configHome}/npm/config/npm-init.js
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
'';
"python/pythonrc".text = ''
@ -76,10 +75,10 @@ in {
'';
};
cacheHome = "${hmCfg.home.homeDirectory}/.cache";
configHome = "${hmCfg.home.homeDirectory}/.config";
dataHome = "${hmCfg.home.homeDirectory}/.local/share";
stateHome = "${hmCfg.home.homeDirectory}/.local/state";
cacheHome = XDG_CACHE_HOME;
configHome = XDG_CONFIG_HOME;
dataHome = XDG_DATA_HOME;
stateHome = XDG_STATE_HOME;
mimeApps = {
enable = true;
defaultApplications = let