Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions pkgs/by-name/de/deno/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
nodejs,
git,
python3,
esbuild,
}:

let
Expand All @@ -31,6 +30,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
pname = "deno";
version = "2.5.1";

outputs = [
"out"
# holds denort, used for standalone binaries produced with deno
# https://github.com/denoland/deno/blob/45d333a1c331926d7df80f63c533293be03b0070/cli/standalone/binary.rs#L1206
"rt"
];

src = fetchFromGitHub {
owner = "denoland";
repo = "deno";
Expand Down Expand Up @@ -91,17 +97,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
# To avoid this we pre-download the file and export it via RUSTY_V8_ARCHIVE
env.RUSTY_V8_ARCHIVE = librusty_v8;

# Many tests depend on prebuilt binaries being present at `./third_party/prebuilt`.
# We provide nixpkgs binaries for these for all platforms, but the test runner itself only handles
# these four arch+platform combinations.
doCheck =
stdenv.hostPlatform.isDarwin
|| (stdenv.hostPlatform.isLinux && (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64));

preCheck =
# Provide esbuild binary at `./third_party/prebuilt/` just like upstream:
# https://github.com/denoland/deno_third_party/tree/master/prebuilt
# https://github.com/denoland/deno/blob/main/tests/util/server/src/servers/npm_registry.rs#L402
# Provide placeholder file for esbuild.
# The version of esbuild needs to exactly match the version deno requires
# for currently one integration test.
# https://github.com/evanw/esbuild/blob/195e05c16f03a341390feef38b8ebf17d3075e14/cmd/esbuild/main.go#L206-L214
# Updating esbuild in lockstep with deno releases isn't ideal and neither is
# modifying the deno source and diverging from upstream.
# A placeholder must be provided or the code which mocks an npm registry
# will fail for over 260 tests which use it.
let
platform =
if stdenv.hostPlatform.isLinux then
Expand All @@ -120,7 +124,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
in
''
mkdir -p ./third_party/prebuilt/${platform}
cp ${lib.getExe esbuild} ./third_party/prebuilt/${platform}/esbuild-${arch}
touch ./third_party/prebuilt/${platform}/esbuild-${arch}
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# Unset the env var defined by bintools-wrapper because it triggers Deno's sandbox protection in some tests.
Expand Down Expand Up @@ -169,6 +173,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
# Use of VSOCK, might not be available on all platforms
"--skip=js_unit_tests::serve_test"
"--skip=js_unit_tests::fetch_test"

# Requires a specific release of esbuild.
"--skip=watcher::bundle_watch"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Expects specific shared libraries from macOS to be linked
Expand Down Expand Up @@ -204,7 +211,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
'';

postInstall = ''
# Remove non-essential binaries like denort and test_server
mkdir -p "$rt/bin"
mv "$out/bin/denort" "$rt/bin/"
# Remove non-essential binaries like test_server
find $out/bin/* -not -name "deno" -delete
''
+ lib.optionalString canExecute ''
Expand All @@ -225,7 +234,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
passthru.updateScript = ./update/update.ts;
passthru.tests = callPackage ./tests { };

meta = with lib; {
meta = {
homepage = "https://deno.land/";
changelog = "https://github.com/denoland/deno/releases/tag/v${finalAttrs.version}";
description = "Secure runtime for JavaScript and TypeScript";
Expand All @@ -238,9 +247,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
Among other things, Deno is a great replacement for utility scripts that may have been historically written with
bash or python.
'';
license = licenses.mit;
license = lib.licenses.mit;
mainProgram = "deno";
maintainers = with maintainers; [
maintainers = with lib.maintainers; [
jk
ofalvai
];
Expand Down
Loading