14 asdfReshimFile = writeScript "asdf-reshim" ''
17 # asdf-vm create "shim" file like this:
19 # exec $ASDF_DIR/bin/asdf exec "node" "$@"
21 # So we should reshim all installed versions every time shell initialized,
22 # because $out always change
24 asdfDir="''${ASDF_DIR:-$HOME/.asdf}"
25 asdfDataDir="''${ASDF_DATA_DIR:-$HOME/.asdf}"
27 prevAsdfDirFilePath="$asdfDataDir/.nix-prev-asdf-dir-path"
29 if [ -r "$prevAsdfDirFilePath" ]; then
30 prevAsdfDir="$(cat "$prevAsdfDirFilePath")"
35 if [ "$prevAsdfDir" != "$asdfDir" ]; then
36 rm -rf "$asdfDataDir"/shims
37 "$asdfDir"/bin/asdf reshim
38 echo "$asdfDir" > "$prevAsdfDirFilePath"
42 asdfPrepareFile = writeScript "asdf-prepare" ''
45 source "$ASDF_DIR/asdf.sh"
49 stdenv.mkDerivation rec {
53 src = fetchFromGitHub {
57 sha256 = "sha256-1dacsAoZVwoQv8+V4FrjRLa7awLIZchlhkuET0wTO7w=";
72 mkdir -p $out/share/asdf-vm
73 cp -r . $out/share/asdf-vm
75 mkdir -p $out/etc/profile.d
76 substitute ${asdfPrepareFile} $out/etc/profile.d/asdf-prepare.sh \
77 --replace "@asdfDir@" "$out/share/asdf-vm"
80 makeWrapper $out/share/asdf-vm/bin/asdf $out/bin/asdf \
81 --set ASDF_DIR $out/share/asdf-vm
83 installShellCompletion --cmd asdf \
84 --zsh completions/_asdf \
85 --fish completions/asdf.fish \
86 --bash completions/asdf.bash
90 description = "Extendable version manager with support for Ruby, Node.js, Erlang & more";
91 homepage = "https://asdf-vm.com/";
92 license = licenses.mit;
93 maintainers = [ maintainers.c4605 ];
95 platforms = platforms.unix;