diff --git a/home.nix b/home.nix index 11f8371..8139764 100644 --- a/home.nix +++ b/home.nix @@ -43,7 +43,16 @@ ]; activation = { - cleanAppCaches = lib.hm.dag.entryAfter [ "onFilesChange" "installPackages" "copyFonts" ] '' + updateAppCaches = lib.hm.dag.entryAfter [ "onFilesChange" "installPackages" "copyFonts" ] '' + # nixpkgs + echo "Calculating new NIX_PATH value ..." + mkdir -p "$HOME/.cache/fish" + nix flake metadata ~/.config/nixpkgs --json 2>/dev/null | \ + jq -r '.locks.nodes.nixpkgs.locked | "\(.type):\(.owner)/\(.repo)/\(.rev)"' | \ + xargs -I {} nix flake metadata {} --json | \ + jq -r '. | "nixpkgs=\(.path)"' >"$HOME/.cache/fish/nix_path_value" + + # neovim echo -n "Running LuaCacheClear: " nvim -c 'try | execute "LuaCacheClear" | echo "Done" | catch /.*/ | echo "Command not found" | endtry | q' --headless printf '\nRemoving luacache file: ' diff --git a/programs/fish.nix b/programs/fish.nix index 0654eec..3a43156 100644 --- a/programs/fish.nix +++ b/programs/fish.nix @@ -36,7 +36,7 @@ ytdl = "ytdl_with_options"; ytdl_mp4 = "ytdl_with_options -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'"; yti = "ytdl_with_options -F"; - upa = "nix-channel --update nixpkgs && nix flake update ~/.config/nixpkgs -v"; + upa = "nix flake update ~/.config/nixpkgs -v"; upp = "nix flake update ./ -v"; upn = "$HOME/.config/nixpkgs/programs/nvim/update-plugins.sh"; ucl = "nix-collect-garbage -d && nix-store --gc && nix-store --optimise -v"; @@ -54,6 +54,10 @@ }; shellInit = '' + if test -e "$HOME/.cache/fish/nix_path_value" + set -gx NIX_PATH (cat "$HOME/.cache/fish/nix_path_value") + end + if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh end