Add rust-project to the buck2 package
This is not added as a separate package for a few reasons: - It is part of the official (though pre-release) Buck2 distribution. - It has not yet been renamed to `buck2-rust-project`, and the package name `rust-project` might be too confusing to have in Nixpkgs. - The extra 4.4M are arguably not a dealbreaker. Most Buck2 projects are likely to be complex enough that the extra disk/network usage would be marginal.
This commit is contained in:
committed by
Austin Seipp
parent
7088d453ef
commit
ce618668cb
@@ -1,7 +1,11 @@
|
||||
{ "_comment": "@generated by pkgs/by-name/bu/buck2/update.sh"
|
||||
, "_prelude": "sha256-o/YUIu8vuIIk2kfkMaijZNVLqwELwum4mFJ9sbqnDIs="
|
||||
, "x86_64-linux": "sha256-kN+nB1PAYIxG52BGM7kOmgUxVDKXhcWzyGyvWQ+CvTo="
|
||||
, "x86_64-darwin": "sha256-oRDdUjHwtGB4xBj0tzJEIiAyI6LUVEVQbjNqdEJwu5E="
|
||||
, "aarch64-linux": "sha256-9Y5ODzE90sAIKjxtZMA8nEkKPLfrpcQjPw0HPzzh/Hs="
|
||||
, "aarch64-darwin": "sha256-kyPtJvkJ/fWCFqwtueqXsiazeu8xcAeXxvwQG+FjQ4M="
|
||||
, "buck2-x86_64-linux": "sha256-kN+nB1PAYIxG52BGM7kOmgUxVDKXhcWzyGyvWQ+CvTo="
|
||||
, "rust-project-x86_64-linux": "sha256-UbC43xyEIIT76K2OHnp4lBo3saoTeuZxYDRieEry+tE="
|
||||
, "buck2-x86_64-darwin": "sha256-oRDdUjHwtGB4xBj0tzJEIiAyI6LUVEVQbjNqdEJwu5E="
|
||||
, "rust-project-x86_64-darwin": "sha256-mp8xR4bFb9esN3QABG03H07t09caMNQLKOqxdg8+CEw="
|
||||
, "buck2-aarch64-linux": "sha256-9Y5ODzE90sAIKjxtZMA8nEkKPLfrpcQjPw0HPzzh/Hs="
|
||||
, "rust-project-aarch64-linux": "sha256-rwT6mO0lyRnyCfdUtYcdelJArHZCHP6K/A//n+yLtgA="
|
||||
, "buck2-aarch64-darwin": "sha256-kyPtJvkJ/fWCFqwtueqXsiazeu8xcAeXxvwQG+FjQ4M="
|
||||
, "rust-project-aarch64-darwin": "sha256-JYQiCEcplVHTK2iPLDBpGyyoMXU5B0/P/r8VCN1IDko="
|
||||
}
|
||||
|
||||
@@ -46,24 +46,34 @@ let
|
||||
# our version of buck2; this should be a git tag
|
||||
version = "2025-01-02";
|
||||
|
||||
# map our platform name to the rust toolchain suffix
|
||||
# NOTE (aseipp): must be synchronized with update.sh!
|
||||
platform-suffix =
|
||||
{
|
||||
x86_64-darwin = "x86_64-apple-darwin";
|
||||
aarch64-darwin = "aarch64-apple-darwin";
|
||||
x86_64-linux = "x86_64-unknown-linux-musl";
|
||||
aarch64-linux = "aarch64-unknown-linux-musl";
|
||||
}
|
||||
."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
|
||||
# the platform-specific, statically linked binary — which is also
|
||||
# zstd-compressed
|
||||
src =
|
||||
buck2-src =
|
||||
let
|
||||
suffix =
|
||||
{
|
||||
# map our platform name to the rust toolchain suffix
|
||||
# NOTE (aseipp): must be synchronized with update.sh!
|
||||
x86_64-darwin = "x86_64-apple-darwin";
|
||||
aarch64-darwin = "aarch64-apple-darwin";
|
||||
x86_64-linux = "x86_64-unknown-linux-musl";
|
||||
aarch64-linux = "aarch64-unknown-linux-musl";
|
||||
}
|
||||
."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
name = "buck2-${version}-${platform-suffix}.zst";
|
||||
hash = buildHashes."buck2-${stdenv.hostPlatform.system}";
|
||||
url = "https://github.com/facebook/buck2/releases/download/${version}/buck2-${platform-suffix}.zst";
|
||||
in
|
||||
fetchurl { inherit name url hash; };
|
||||
|
||||
name = "buck2-${version}-${suffix}.zst";
|
||||
hash = buildHashes."${stdenv.hostPlatform.system}";
|
||||
url = "https://github.com/facebook/buck2/releases/download/${version}/buck2-${suffix}.zst";
|
||||
# rust-project, which is used to provide IDE integration Buck2 Rust projects,
|
||||
# is part of the official distribution
|
||||
rust-project-src =
|
||||
let
|
||||
name = "rust-project-${version}-${platform-suffix}.zst";
|
||||
hash = buildHashes."rust-project-${stdenv.hostPlatform.system}";
|
||||
url = "https://github.com/facebook/buck2/releases/download/${version}/rust-project-${platform-suffix}.zst";
|
||||
in
|
||||
fetchurl { inherit name url hash; };
|
||||
|
||||
@@ -83,7 +93,11 @@ in
|
||||
stdenv.mkDerivation {
|
||||
pname = "buck2";
|
||||
version = "unstable-${version}"; # TODO (aseipp): kill 'unstable' once a non-prerelease is made
|
||||
inherit src;
|
||||
srcs = [
|
||||
buck2-src
|
||||
rust-project-src
|
||||
];
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
@@ -94,12 +108,13 @@ stdenv.mkDerivation {
|
||||
dontConfigure = true;
|
||||
dontStrip = true;
|
||||
|
||||
unpackPhase = "unzstd ${src} -o ./buck2";
|
||||
buildPhase = "chmod +x ./buck2";
|
||||
checkPhase = "./buck2 --version";
|
||||
unpackPhase = "unzstd ${buck2-src} -o ./buck2 && unzstd ${rust-project-src} -o ./rust-project";
|
||||
buildPhase = "chmod +x ./buck2 && chmod +x ./rust-project";
|
||||
checkPhase = "./buck2 --version && ./rust-project --version";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
install -D buck2 $out/bin/buck2
|
||||
install -D rust-project $out/bin/rust-project
|
||||
'';
|
||||
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd buck2 \
|
||||
|
||||
@@ -36,7 +36,12 @@ for arch in "${ARCHS[@]}"; do
|
||||
IFS=: read -r arch_name arch_target <<< "$arch"
|
||||
sha256hash="$(nix-prefetch-url --type sha256 "https://github.com/facebook/buck2/releases/download/${VERSION}/buck2-${arch_target}.zst")"
|
||||
srihash="$(nix hash to-sri --type sha256 "$sha256hash")"
|
||||
echo ", \"$arch_name\": \"$srihash\"" >> "$HFILE"
|
||||
echo ", \"buck2-$arch_name\": \"$srihash\"" >> "$HFILE"
|
||||
|
||||
IFS=: read -r arch_name arch_target <<< "$arch"
|
||||
sha256hash="$(nix-prefetch-url --type sha256 "https://github.com/facebook/buck2/releases/download/${VERSION}/rust-project-${arch_target}.zst")"
|
||||
srihash="$(nix hash to-sri --type sha256 "$sha256hash")"
|
||||
echo ", \"rust-project-$arch_name\": \"$srihash\"" >> "$HFILE"
|
||||
done
|
||||
echo "}" >> "$HFILE"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user