From 6df90f2470db9ec3b2febf684a08493dcddf2459 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2023 21:23:53 +0200 Subject: Configure programs to "follow" XDG spec --- user/settings/base.nix | 32 +++++++++++++++++++++++++++----- user/settings/development/javascript.nix | 2 +- user/settings/satoshipay.nix | 2 +- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/user/settings/base.nix b/user/settings/base.nix index eac06748..a3a67593 100644 --- a/user/settings/base.nix +++ b/user/settings/base.nix @@ -12,10 +12,29 @@ manual = { html.enable = true; }; - home.sessionVariables = { - EMAIL = "alan@alanpearce.eu"; - MANPAGER = "bat -l man -p"; - }; + home.sessionVariables = + let + conf = config.xdg.configHome; + data = config.xdg.dataHome; + cache = config.xdg.cacheHome; + state = config.xdg.stateHome; + in + { + EMAIL = "alan@alanpearce.eu"; + MANPAGER = "bat -l man -p"; + ABDUCO_SOCKET_DIR = "${state}/abduco"; + GNUPGHOME = "${data}/gnupg"; + SOLARGRAPH_CACHE = "${cache}/solargraph"; + ASPELL_CONF = "per-conf ${conf}/aspell/aspell.conf; personal ${conf}/aspell/en.pws; repl ${conf}/aspell/en.prepl"; + ELECTRUMDIR = "${data}/electrum"; + DOCKER_CONFIG = "${conf}/docker"; + npm_config_userconfig = "${conf}/npm/config"; + PASSWORD_STORE_HOME = "${data}/password-store"; + WGETRC = pkgs.writeText "wgetrc" '' + hsts-file = ${cache}/wget-hsts + ''; + SQLITE_HISTORY = "${data}/sqlite_history"; + }; xdg = { enable = true; cacheHome = @@ -24,7 +43,10 @@ else "${config.home.homeDirectory}/.cache"; configHome = "${config.home.homeDirectory}/.config"; dataHome = "${config.home.homeDirectory}/.local/share"; - stateHome = "${config.home.homeDirectory}/.local/state"; + stateHome = + if pkgs.stdenv.isDarwin + then "${config.home.homeDirectory}/Library/Caches/TemporaryItems/State" + else "${config.home.homeDirectory}/.local/state"; }; home.shellAliases = { diff --git a/user/settings/development/javascript.nix b/user/settings/development/javascript.nix index 4e6722f9..d68de810 100644 --- a/user/settings/development/javascript.nix +++ b/user/settings/development/javascript.nix @@ -119,7 +119,7 @@ in npul = "npm unlink"; }; - home.file.".npmrc".text = '' + xdg.configFile."npm/config".text = '' prefix=''${HOME}/.local cache=${config.xdg.cacheHome}/npm/ store-dir=${config.xdg.cacheHome}/pnpm/ diff --git a/user/settings/satoshipay.nix b/user/settings/satoshipay.nix index 798960bb..558f8791 100644 --- a/user/settings/satoshipay.nix +++ b/user/settings/satoshipay.nix @@ -107,7 +107,7 @@ in }; }; - home.file.".npmrc".text = '' + xdg.configFile."npm/config".text = '' @satoshipay:registry=https://registry.npmjs.org/ ''; } -- cgit 1.4.1