mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 21:04:30 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
98 lines
2.1 KiB
Nix
98 lines
2.1 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
fetchFromGitHub,
|
|
makeWrapper,
|
|
installShellFiles,
|
|
bash,
|
|
curl,
|
|
git,
|
|
writeScript,
|
|
}:
|
|
|
|
let
|
|
asdfReshimFile = writeScript "asdf-reshim" ''
|
|
#!/usr/bin/env bash
|
|
|
|
# asdf-vm create "shim" file like this:
|
|
#
|
|
# exec $ASDF_DIR/bin/asdf exec "node" "$@"
|
|
#
|
|
# So we should reshim all installed versions every time shell initialized,
|
|
# because $out always change
|
|
|
|
asdfDir="''${ASDF_DIR:-$HOME/.asdf}"
|
|
asdfDataDir="''${ASDF_DATA_DIR:-$HOME/.asdf}"
|
|
|
|
prevAsdfDirFilePath="$asdfDataDir/.nix-prev-asdf-dir-path"
|
|
|
|
if [ -r "$prevAsdfDirFilePath" ]; then
|
|
prevAsdfDir="$(cat "$prevAsdfDirFilePath")"
|
|
else
|
|
prevAsdfDir=""
|
|
fi
|
|
|
|
if [ "$prevAsdfDir" != "$asdfDir" ]; then
|
|
rm -rf "$asdfDataDir"/shims
|
|
"$asdfDir"/bin/asdf reshim
|
|
echo "$asdfDir" > "$prevAsdfDirFilePath"
|
|
fi
|
|
'';
|
|
|
|
asdfPrepareFile = writeScript "asdf-prepare" ''
|
|
ASDF_DIR="@asdfDir@"
|
|
|
|
source "$ASDF_DIR/asdf.sh"
|
|
${asdfReshimFile}
|
|
'';
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "asdf-vm";
|
|
version = "0.14.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "asdf-vm";
|
|
repo = "asdf";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-1dacsAoZVwoQv8+V4FrjRLa7awLIZchlhkuET0wTO7w=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = [
|
|
bash
|
|
curl
|
|
git
|
|
];
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/share/asdf-vm
|
|
cp -r . $out/share/asdf-vm
|
|
|
|
mkdir -p $out/etc/profile.d
|
|
substitute ${asdfPrepareFile} $out/etc/profile.d/asdf-prepare.sh \
|
|
--replace "@asdfDir@" "$out/share/asdf-vm"
|
|
|
|
mkdir -p $out/bin
|
|
makeWrapper $out/share/asdf-vm/bin/asdf $out/bin/asdf \
|
|
--set ASDF_DIR $out/share/asdf-vm
|
|
|
|
installShellCompletion --cmd asdf \
|
|
--zsh completions/_asdf \
|
|
--fish completions/asdf.fish \
|
|
--bash completions/asdf.bash
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Extendable version manager with support for Ruby, Node.js, Erlang & more";
|
|
homepage = "https://asdf-vm.com/";
|
|
license = licenses.mit;
|
|
maintainers = [ maintainers.c4605 ];
|
|
mainProgram = "asdf";
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|