Skip to content

Instantly share code, notes, and snippets.

@Lillecarl
Last active January 6, 2025 05:05
Show Gist options
  • Save Lillecarl/31bcb36e28211a189a5b0c2850145122 to your computer and use it in GitHub Desktop.
Save Lillecarl/31bcb36e28211a189a5b0c2850145122 to your computer and use it in GitHub Desktop.
#! /usr/bin/env fish
function padd
for path in $(nix build nixpkgs#$argv[1] --print-out-paths --no-link)
set bin "$path/bin"
if test -d $bin
echo "Added $bin to PATH"
set --prepend --global PATH $bin
end
end
end
#! /usr/bin/env bash
padd() {
# Use nix to build and get the output paths
for path in $(nix build nixpkgs#$1 --print-out-paths --no-link); do
bin="$path/bin"
# Check if the directory exists
if [ -d "$bin" ]; then
echo "Added $bin to PATH"
# Prepend the bin directory to PATH
PATH="$bin:$PATH"
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment