Skip to content

Instantly share code, notes, and snippets.

@Brettm12345
Last active February 10, 2020 05:14
Show Gist options
  • Save Brettm12345/b5bd3883e9de4f44b7c8e04d6c8f81a9 to your computer and use it in GitHub Desktop.
Save Brettm12345/b5bd3883e9de4f44b7c8e04d6c8f81a9 to your computer and use it in GitHub Desktop.
Nixos package install script with FZF
#! /usr/bin/env nix-shell
#! nix-shell -i sh -p jq awk fzf
PKG=$(nix search "$1" --json \
| jq -r '. | to_entries | map("\(.key)|\(.value.version)|\(.value.description)") | join("\n")' \
| awk -F "|" '{ printf "\033[34m%-40s \033[32m%-20s \033[0m%s\n", $1, $2, $3 }' \
| fzf \
| awk '{ print $1 }'
)
test -n "$PKG" && nix-env -iA "$PKG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment