1
0
Fork 0

Add workaround for setting NIX_PATH to the flake rev

This commit is contained in:
Daniel Kempkens 2021-12-19 19:52:09 +01:00
parent 1da24bb542
commit d36112eb04
2 changed files with 15 additions and 2 deletions

View file

@ -43,7 +43,16 @@
]; ];
activation = { 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: " echo -n "Running LuaCacheClear: "
nvim -c 'try | execute "LuaCacheClear" | echo "Done" | catch /.*/ | echo "Command not found" | endtry | q' --headless nvim -c 'try | execute "LuaCacheClear" | echo "Done" | catch /.*/ | echo "Command not found" | endtry | q' --headless
printf '\nRemoving luacache file: ' printf '\nRemoving luacache file: '

View file

@ -36,7 +36,7 @@
ytdl = "ytdl_with_options"; ytdl = "ytdl_with_options";
ytdl_mp4 = "ytdl_with_options -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'"; ytdl_mp4 = "ytdl_with_options -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'";
yti = "ytdl_with_options -F"; 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"; upp = "nix flake update ./ -v";
upn = "$HOME/.config/nixpkgs/programs/nvim/update-plugins.sh"; upn = "$HOME/.config/nixpkgs/programs/nvim/update-plugins.sh";
ucl = "nix-collect-garbage -d && nix-store --gc && nix-store --optimise -v"; ucl = "nix-collect-garbage -d && nix-store --gc && nix-store --optimise -v";
@ -54,6 +54,10 @@
}; };
shellInit = '' 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 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 fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
end end