From 648ba55069bc5934e7d8b9d3f7c7609f27041a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Sun, 19 May 2024 18:11:57 +0200 Subject: [PATCH] treewide: move everything to xdg --- modules/home/common/default.nix | 1 + modules/home/common/xdg.nix | 29 +++++++++++++++++++++++++ modules/system/settei/sane-defaults.nix | 1 + 3 files changed, 31 insertions(+) create mode 100644 modules/home/common/xdg.nix diff --git a/modules/home/common/default.nix b/modules/home/common/default.nix index e5bd18a..28e907b 100644 --- a/modules/home/common/default.nix +++ b/modules/home/common/default.nix @@ -20,6 +20,7 @@ in imports = [ ./desktop fishOverlayModule + ./xdg.nix ]; programs.fish.enable = true; diff --git a/modules/home/common/xdg.nix b/modules/home/common/xdg.nix new file mode 100644 index 0000000..357b52a --- /dev/null +++ b/modules/home/common/xdg.nix @@ -0,0 +1,29 @@ +{ config, ... }: +let + inherit (config.xdg) + dataHome + cacheHome + configHome + stateHome + ; +in +{ + xdg.enable = true; + + home.sessionVariables = { + SQLITE_HISTORY = "${cacheHome}/sqlite_history"; + PSQL_HISTORY = "${dataHome}/psql_history"; + NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc"; + NODE_REPL_HISTORY = "${dataHome}/node_repl_history"; + LESSHISTFILE = "${stateHome}/less/history"; + GRADLE_USER_HOME = "${dataHome}/gradle"; + GEM_SPEC_CACHE = "${cacheHome}/gem"; + GEM_HOME = "${dataHome}/gem"; + CP_HOME_DIR = "${dataHome}/cocoapods"; + CARGO_HOME = "${dataHome}/cargo"; + W3M_DIR = "${dataHome}/w3m"; + STACK_XDG = 1; + }; + + # TODO: Manage npmrc with nix too +} diff --git a/modules/system/settei/sane-defaults.nix b/modules/system/settei/sane-defaults.nix index 03fe86b..7954343 100644 --- a/modules/system/settei/sane-defaults.nix +++ b/modules/system/settei/sane-defaults.nix @@ -57,6 +57,7 @@ let "auto-allocate-uids" ]; trusted-users = lib.optionals (!adminNeedsPassword) [ username ]; + use-xdg-base-directories = true; auto-allocate-uids = true; extra-substituters = [ "https://hyprland.cachix.org"