From d1a656d27eca8a837c1b91753692151e9db910a7 Mon Sep 17 00:00:00 2001 From: Chris Dombroski Date: Sat, 31 Aug 2024 12:09:19 -0400 Subject: [PATCH] XDG! --- systems/smolboi/configuration.nix | 2 ++ systems/smolboi/home.nix | 32 ++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/systems/smolboi/configuration.nix b/systems/smolboi/configuration.nix index 5624c1d..2412dbf 100644 --- a/systems/smolboi/configuration.nix +++ b/systems/smolboi/configuration.nix @@ -42,6 +42,8 @@ }; }; + nix.settings.use-xdg-base-directories = true; + services = { ratbagd.enable = true; displayManager = { diff --git a/systems/smolboi/home.nix b/systems/smolboi/home.nix index d890160..a83c731 100644 --- a/systems/smolboi/home.nix +++ b/systems/smolboi/home.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: { # Home Manager needs a bit of information about you and the paths it should @@ -28,7 +28,6 @@ hack-font htop jellyfin-media-player - nodejs konversation nixd yakuake @@ -42,7 +41,6 @@ knossosnet lilypond musescore - spotify protontricks protonup-qt (retroarch.override { @@ -100,7 +98,7 @@ permittedInsecurePackages = [ "electron-25.9.0" ]; }; xdg.configFile."autostart/yakuake.desktop".source = - "${pkgs.yakuake.outPath}/share/applications/org.kde.yakuake.desktop"; + "${pkgs.yakuake}/share/applications/org.kde.yakuake.desktop"; # Home Manager is pretty good at managing dotfiles. The primary way to manage # plain files is through 'home.file'. @@ -117,6 +115,9 @@ # ''; }; + home.preferXdgDirectories = true; + xdg.enable = true; + # Home Manager can also manage your environment variables through # 'home.sessionVariables'. If you don't want to manage your shell through Home # Manager then you have to manually source 'hm-session-vars.sh' located at @@ -133,9 +134,25 @@ # /etc/profiles/per-user/cdombroski/etc/profile.d/hm-session-vars.sh # home.sessionVariables = { - # EDITOR = "emacs"; + ANDROID_USER_HOME = "${config.xdg.dataHome}/android"; + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + DOTNET_CLI_HOME = "${config.xdg.dataHome}/dotnet"; + DVDCSS_CACHE = "${config.xdg.dataHome}/dvdcss"; + GRADLE_USER_HOME = "${config.xdg.dataHome}/gradle"; + JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${config.xdg.configHome}/java"; + NODE_REPL_HISTORY = "${config.xdg.stateHome}/node_repl_history"; + NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc"; + PYTHON_HISTORY = "${config.xdg.stateHome}/python_history"; + RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; + XCOMPOSE_CACHE = "${config.xdg.cacheHome}/X11/xcompose"; + }; + home.shellAliases = { + adb = ''HOME="${config.xdg.dataHome}/android" adb''; + mvn = "mvn -gs ${config.xdg.configHome}/maven/settings.xml"; + wget = "wget --hsts-file=${config.xdg.dataHome}/wget-hsts"; }; home.sessionPath = [ "$HOME/.local/bin" ]; + gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; # Let Home Manager install and manage itself. programs = { @@ -143,11 +160,16 @@ bash = { enable = true; enableCompletion = true; + historyFile = "${config.xdg.stateHome}/bash/history"; }; direnv = { enable = true; nix-direnv.enable = true; }; + gpg = { + enable = true; + homedir = "${config.xdg.dataHome}/gnupg"; + }; vim = { enable = true; defaultEditor = true;