Add workaround for setting NIX_PATH to the flake rev
This commit is contained in:
parent
1da24bb542
commit
d36112eb04
2 changed files with 15 additions and 2 deletions
11
home.nix
11
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: '
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue