From 8345fae991a6f1bb7b8b3edc2e27ac5949eda26a Mon Sep 17 00:00:00 2001 From: William Hsieh Date: Mon, 18 Sep 2023 19:40:00 +0800 Subject: [PATCH] feat(nix): follow xdg directories --- home.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/home.nix b/home.nix index 128415fe..fafeea36 100644 --- a/home.nix +++ b/home.nix @@ -34,6 +34,8 @@ in { ]; }; + xdg.enable = true; + xdg.configFile = { "nvim".source = link ".config/nvim"; "alacritty".source = link ".config/alacritty"; @@ -81,13 +83,13 @@ in { initExtraFirst = '' # p10k instant prompt echo "" - if [[ -r "''${XDG_CACHE_HOME:-''$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then - source "''${XDG_CACHE_HOME:-''$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" + if [[ -r "${config.xdg.cacheHome}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then + source "${config.xdg.cacheHome}/p10k-instant-prompt-''${(%):-%n}.zsh" fi # source nix profile - if [[ -r "''$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then - source "''$HOME/.nix-profile/etc/profile.d/nix.sh" + if [[ -r "${config.xdg.stateHome}/nix/profiles/profile/etc/profile.d/nix.sh" ]]; then + source "${config.xdg.stateHome}/nix/profiles/profile/etc/profile.d/nix.sh" fi ''; initExtra = "source ~/.zshrc";