Last active
February 10, 2020 05:14
-
-
Save Brettm12345/b5bd3883e9de4f44b7c8e04d6c8f81a9 to your computer and use it in GitHub Desktop.
Nixos package install script with FZF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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