nix/misc/xdg.nix

86 lines
2.5 KiB
Nix
Raw Normal View History

2024-07-04 01:14:24 +02:00
{ config, lib, pkgs, ... }:
2024-07-04 01:13:59 +02:00
let
HOME = config.home-manager.users.krizej.home.homeDirectory;
2024-07-12 16:56:54 +02:00
XDG_DATA_HOME = "${HOME}/.local/share";
XDG_CONFIG_HOME = "${HOME}/.config";
XDG_STATE_HOME = "${HOME}/.local/state";
XDG_CACHE_HOME = "${HOME}/.cache";
2024-07-04 01:13:59 +02:00
in {
2024-07-12 16:56:54 +02:00
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
config.common.default = [ "*" ];
};
2024-07-04 01:13:59 +02:00
home-manager.users.krizej = {
home.packages = with pkgs; [
2024-07-04 01:14:24 +02:00
xdg-user-dirs
xdg-utils
2024-07-04 01:13:59 +02:00
];
2024-07-12 16:56:54 +02:00
home.sessionVariables = {
2024-07-14 01:17:46 +02:00
XDG_DATA_HOME = "${HOME}/.local/share";
XDG_CONFIG_HOME = "${HOME}/.config";
XDG_STATE_HOME = "${HOME}/.local/state";
XDG_CACHE_HOME = "${HOME}/.cache";
2024-07-04 01:13:59 +02:00
# xdg crap thx poz
ANDROID_USER_HOME = "${XDG_DATA_HOME}/android";
ANDROID_HOME = "${XDG_DATA_HOME}/android/sdk";
GRADLE_USER_HOME = "${XDG_DATA_HOME}/gradle";
PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc";
HISTFILE = "${XDG_CACHE_HOME}/bash/history";
CARGO_HOME = "${XDG_DATA_HOME}/cargo";
_JAVA_OPTIONS = "-Djava.utils.prefs.userRoot=${XDG_CONFIG_HOME}/java";
GNUPGHOME = "${XDG_DATA_HOME}/gnupg";
WINEPREFIX = "${XDG_DATA_HOME}/wine";
RUSTUP_HOME = "${XDG_DATA_HOME}/rustup";
NUGET_PACKAGES = "${XDG_CACHE_HOME}/NuGetPackages";
FCEUX_HOME = "${XDG_CONFIG_HOME}/fceux";
DOTNET_CLI_HOME = "${XDG_CONFIG_HOME}/dotnet";
GTK2_RC_FILES = lib.mkForce "${XDG_CONFIG_HOME}/gtk-2.0/gtkrc";
};
2024-07-12 16:56:54 +02:00
xdg = {
dataHome = XDG_DATA_HOME;
configHome = XDG_CONFIG_HOME;
stateHome = XDG_STATE_HOME;
cacheHome = XDG_CACHE_HOME;
2024-07-05 01:26:15 +02:00
2024-07-12 16:56:54 +02:00
userDirs = {
enable = true;
desktop = "${HOME}/desktop";
documents = "${HOME}/documents";
download = "${HOME}/downloads";
music = "${HOME}/music";
pictures = "${HOME}/pictures";
publicShare = "${HOME}/public";
templates = "${HOME}/templates";
videos = "${HOME}/videos";
};
2024-07-05 01:26:15 +02:00
2024-07-12 16:56:54 +02:00
configFile = {
"python/pythonrc".text = ''
import os
import atexit
import readline
2024-07-05 01:26:15 +02:00
2024-07-12 16:56:54 +02:00
history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history')
try:
readline.read_history_file(history)
except OSError:
pass
2024-07-05 01:26:15 +02:00
2024-07-12 16:56:54 +02:00
def write_history():
try:
readline.write_history_file(history)
except OSError:
pass
2024-07-05 01:26:15 +02:00
2024-07-12 16:56:54 +02:00
atexit.register(write_history)
'';
};
2024-07-05 01:26:15 +02:00
};
2024-07-04 01:13:59 +02:00
};
}