home/use-xdg: add more stuff

This commit is contained in:
Artemis Tosini 2024-02-10 05:50:24 +00:00
parent 613cb83d90
commit 30f12f4227
Signed by: artemist
SSH key fingerprint: SHA256:EsuWCwx6fjxxExxf65rX+ocQJJAdw4R1KarpFue6Uwc

View file

@ -8,9 +8,39 @@
IPYTHONDIR = "${config.xdg.configHome}/ipython"; IPYTHONDIR = "${config.xdg.configHome}/ipython";
JUPYTER_CONFIG_DIR = "${config.xdg.configHome}/jupyter"; JUPYTER_CONFIG_DIR = "${config.xdg.configHome}/jupyter";
LESSHISTFILE = "${config.xdg.stateHome}/less/history"; LESSHISTFILE = "${config.xdg.stateHome}/less/history";
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
NUGET_PACKAGES = "${config.xdg.cacheHome}/nuget/packages"; NUGET_PACKAGES = "${config.xdg.cacheHome}/nuget/packages";
PARALLEL_HOME = "${config.xdg.configHome}/parallel"; PARALLEL_HOME = "${config.xdg.configHome}/parallel";
PLATFORMIO_CORE_DIR = "${config.xdg.dataHome}/platformio"; PLATFORMIO_CORE_DIR = "${config.xdg.dataHome}/platformio";
PYTHONSTARTUP = "${config.xdg.configHome}/python/pythonrc";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
}; };
xdg.configFile = {
"npm/npmrc".text = ''
prefix=${config.xdg.dataHome}/npm
cache=${config.xdg.cacheHome}/npm
'';
"python/pythonrc".text = ''
def is_vanilla() -> bool:
import sys
return not hasattr(__builtins__, '__IPYTHON__') and 'bpython' not in sys.argv[0]
def setup_history():
import atexit
import readline
from pathlib import Path
state_home = Path("${config.xdg.stateHome}")
history = state_home / "python" / "history"
readline.read_history_file(str(history))
atexit.register(readline.write_history_file, str(history))
if is_vanilla():
setup_history()
'';
};
} }