deno: move to finalAttrs and programmatically adjust Cargo.toml
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
fetchFromGitHub,
|
||||
rustPlatform,
|
||||
cmake,
|
||||
yq,
|
||||
protobuf,
|
||||
installShellFiles,
|
||||
librusty_v8 ? callPackage ./librusty_v8.nix {
|
||||
@@ -18,14 +19,14 @@
|
||||
let
|
||||
canExecute = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "deno";
|
||||
version = "2.2.10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "denoland";
|
||||
repo = "deno";
|
||||
tag = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-6Tuoxvatfm3edkUiMDGmCZdl/jLKr7WH8WCXR14jKT4=";
|
||||
};
|
||||
|
||||
@@ -34,23 +35,21 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
postPatch = ''
|
||||
# Use patched nixpkgs libffi in order to fix https://github.com/libffi/libffi/pull/857
|
||||
substituteInPlace Cargo.toml --replace-fail "libffi = \"=3.2.0\"" "libffi = { version = \"3.2.0\", features = [\"system\"] }"
|
||||
tomlq -ti '.workspace.dependencies.libffi = { "version": .workspace.dependencies.libffi, "features": ["system"] }' Cargo.toml
|
||||
'';
|
||||
|
||||
# uses zlib-ng but can't dynamically link yet
|
||||
# https://github.com/rust-lang/libz-sys/issues/158
|
||||
nativeBuildInputs =
|
||||
[
|
||||
rustPlatform.bindgenHook
|
||||
# required by libz-ng-sys crate
|
||||
cmake
|
||||
# required by deno_kv crate
|
||||
protobuf
|
||||
installShellFiles
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
lld
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
rustPlatform.bindgenHook
|
||||
# for tomlq to adjust Cargo.toml
|
||||
yq
|
||||
# required by libz-ng-sys crate
|
||||
cmake
|
||||
# required by deno_kv crate
|
||||
protobuf
|
||||
installShellFiles
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ lld ];
|
||||
|
||||
configureFlags = lib.optionals stdenv.cc.isClang [
|
||||
# This never worked with clang, but became a hard error recently: https://github.com/llvm/llvm-project/commit/3d5b610c864c8f5980eaa16c22b71ff1cf462fae
|
||||
@@ -89,7 +88,7 @@ rustPlatform.buildRustPackage rec {
|
||||
installCheckPhase = lib.optionalString canExecute ''
|
||||
runHook preInstallCheck
|
||||
$out/bin/deno --help
|
||||
$out/bin/deno --version | grep "deno ${version}"
|
||||
$out/bin/deno --version | grep "deno ${finalAttrs.version}"
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
@@ -98,7 +97,7 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://deno.land/";
|
||||
changelog = "https://github.com/denoland/deno/releases/tag/v${version}";
|
||||
changelog = "https://github.com/denoland/deno/releases/tag/v${finalAttrs.version}";
|
||||
description = "Secure runtime for JavaScript and TypeScript";
|
||||
longDescription = ''
|
||||
Deno aims to be a productive and secure scripting environment for the modern programmer.
|
||||
@@ -122,4 +121,4 @@ rustPlatform.buildRustPackage rec {
|
||||
"aarch64-darwin"
|
||||
];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user