2021-03-10 19:52:13 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.home.xdg;
|
|
|
|
in
|
2021-02-21 20:30:21 +01:00
|
|
|
{
|
2023-03-16 17:39:13 +01:00
|
|
|
options.my.home.xdg = with lib; {
|
|
|
|
enable = my.mkDisableOption "XDG configuration";
|
2021-03-10 19:52:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config.xdg = lib.mkIf cfg.enable {
|
2021-02-21 20:30:21 +01:00
|
|
|
enable = true;
|
|
|
|
# File types
|
|
|
|
mime.enable = true;
|
2024-09-27 15:48:26 +02:00
|
|
|
# File associations
|
2021-02-21 20:30:21 +01:00
|
|
|
mimeApps = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2021-02-21 20:32:54 +01:00
|
|
|
# User directories
|
|
|
|
userDirs = {
|
|
|
|
enable = true;
|
|
|
|
# I want them lowercased
|
|
|
|
desktop = "\$HOME/desktop";
|
|
|
|
documents = "\$HOME/documents";
|
|
|
|
download = "\$HOME/downloads";
|
|
|
|
music = "\$HOME/music";
|
|
|
|
pictures = "\$HOME/pictures";
|
|
|
|
publicShare = "\$HOME/public";
|
|
|
|
templates = "\$HOME/templates";
|
|
|
|
videos = "\$HOME/videos";
|
|
|
|
};
|
2021-03-07 18:07:29 +01:00
|
|
|
# A tidy home is a tidy mind
|
|
|
|
dataFile = {
|
2024-11-28 13:07:50 +01:00
|
|
|
"tig/.keep".text = ""; # `tig` uses `XDG_DATA_HOME` specifically...
|
2021-03-07 18:07:29 +01:00
|
|
|
};
|
2024-08-29 12:10:26 +02:00
|
|
|
stateFile = {
|
2024-11-28 13:05:45 +01:00
|
|
|
"bash/.keep".text = "";
|
2024-08-29 12:10:26 +02:00
|
|
|
"python/.keep".text = "";
|
|
|
|
};
|
2021-02-21 20:30:21 +01:00
|
|
|
};
|
2021-03-07 18:01:19 +01:00
|
|
|
|
|
|
|
# I want a tidier home
|
2021-03-10 19:52:13 +01:00
|
|
|
config.home.sessionVariables = with config.xdg; lib.mkIf cfg.enable {
|
2023-03-24 22:09:52 +01:00
|
|
|
ANDROID_HOME = "${dataHome}/android";
|
2023-11-28 15:35:12 +01:00
|
|
|
ANDROID_USER_HOME = "${configHome}/android";
|
2021-03-07 18:34:10 +01:00
|
|
|
CARGO_HOME = "${dataHome}/cargo";
|
|
|
|
DOCKER_CONFIG = "${configHome}/docker";
|
2024-02-08 15:40:48 +01:00
|
|
|
GRADLE_USER_HOME = "${dataHome}/gradle";
|
2024-08-29 12:10:26 +02:00
|
|
|
HISTFILE = "${stateHome}/bash/history";
|
2021-03-07 18:34:10 +01:00
|
|
|
INPUTRC = "${configHome}/readline/inputrc";
|
2024-08-29 12:10:26 +02:00
|
|
|
PSQL_HISTORY = "${stateHome}/psql_history";
|
2024-02-07 20:45:32 +01:00
|
|
|
PYTHONPYCACHEPREFIX = "${cacheHome}/python/";
|
|
|
|
PYTHONUSERBASE = "${dataHome}/python/";
|
|
|
|
PYTHON_HISTORY = "${stateHome}/python/history";
|
2024-08-29 12:10:26 +02:00
|
|
|
REDISCLI_HISTFILE = "${stateHome}/redis/rediscli_history";
|
2024-02-07 20:44:51 +01:00
|
|
|
REPO_CONFIG_DIR = "${configHome}/repo";
|
2023-03-24 22:09:52 +01:00
|
|
|
XCOMPOSECACHE = "${dataHome}/X11/xcompose";
|
2024-03-11 14:53:11 +01:00
|
|
|
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${configHome}/java";
|
2021-03-07 18:01:19 +01:00
|
|
|
};
|
2021-02-21 20:30:21 +01:00
|
|
|
}
|