aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/wrappers/nix-index
blob: 96c399004b9baa100454a73de3c6a9f458bc14e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh -eu

# https://github.com/nix-community/nix-index-database?tab=readme-ov-file#ad-hoc-download

Update() {
	directory=~/.local/share/nix-index
	file="index-$(uname -m | sed 's/^arm64$/aarch64/')-$(uname | tr '[:lower:]' '[:upper:]')"
	mkdir --parents $directory && cd $directory
	wget --quiet --timestamping "https://github.com/Mic92/nix-index-database/releases/latest/download/$file"
  printf "\nUpdating database %s\n\n" "$file"
	ln --symbolic --force "$file" files
}

Update

$(which nix-index --all | grep --invert-match "local/bin" | head --lines 1) "$@"