diff --git a/pkgs/by-name/de/deno/package.nix b/pkgs/by-name/de/deno/package.nix index 73eebbd47a289..ecdb5054db23f 100644 --- a/pkgs/by-name/de/deno/package.nix +++ b/pkgs/by-name/de/deno/package.nix @@ -21,7 +21,6 @@ nodejs, git, python3, - esbuild, }: let @@ -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"; @@ -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 @@ -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. @@ -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 @@ -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 '' @@ -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"; @@ -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 ];