Add a package from nixpkgs to your current fish shell
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
function with --description 'import all arguments as nixpkgs args and put their /bin on PATH' | |
set arg ( \ | |
printf ' | |
let pkgs = import <nixpkgs> {}; | |
in pkgs.symlinkJoin { | |
name = "extra-fish-path"; | |
paths = with pkgs; [ %s ]; | |
} | |
' \ | |
"$argv" \ | |
) | |
set tmpdir (mktemp -d) | |
set outLink "$tmpdir/fish-with-nix-gcroot" | |
# remove gc root on shell exit | |
trap "rm -r $tmpdir" EXIT | |
set outPath ( \ | |
nix-build \ | |
--out-link "$outLink" \ | |
-E "$arg" \ | |
) | |
set --prepend PATH "$outPath/bin" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment