aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2024-02-26 20:44:02 -0500
committertdro <tdro@users.noreply.github.com>2024-02-26 20:44:02 -0500
commitc75cb130c113e8d5c040474d3ee7ac647efc4975 (patch)
treeba3ff408ae3a5ebaf661acaf6836b58e04240434
parent92d8f923660cf0b58395365ee1a170196e29d4d0 (diff)
downloaddotfiles-c75cb130c113e8d5c040474d3ee7ac647efc4975.tar.gz
dotfiles-c75cb130c113e8d5c040474d3ee7ac647efc4975.tar.bz2
dotfiles-c75cb130c113e8d5c040474d3ee7ac647efc4975.zip
.local/bin/wrappers: Add nix-index
-rwxr-xr-x.local/bin/wrappers/nix-index16
1 files changed, 16 insertions, 0 deletions
diff --git a/.local/bin/wrappers/nix-index b/.local/bin/wrappers/nix-index
new file mode 100755
index 0000000..96c3990
--- /dev/null
+++ b/.local/bin/wrappers/nix-index
@@ -0,0 +1,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) "$@"