From 13a5891f1207aaf7306e24bc99f3e304364dcdf9 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Fri, 25 Jul 2025 14:51:46 +0100 Subject: [PATCH 1/3] deno: patch out upgrade check and subcommand Also move patches to subdir and rename with ordering. --- pkgs/by-name/de/deno/package.nix | 14 +++- .../0000-remove-deno-upgrade-check.patch | 41 +++++++++++ .../patches/0001-remove-deno-upgrade.patch | 73 +++++++++++++++++++ .../0002-tests-replace-hardcoded-paths.patch} | 0 .../0003-tests-linux-no-chown.patch} | 0 .../0004-tests-darwin-fixes.patch} | 0 6 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 pkgs/by-name/de/deno/patches/0000-remove-deno-upgrade-check.patch create mode 100644 pkgs/by-name/de/deno/patches/0001-remove-deno-upgrade.patch rename pkgs/by-name/de/deno/{tests-replace-hardcoded-paths.patch => patches/0002-tests-replace-hardcoded-paths.patch} (100%) rename pkgs/by-name/de/deno/{tests-no-chown.patch => patches/0003-tests-linux-no-chown.patch} (100%) rename pkgs/by-name/de/deno/{tests-darwin-differences.patch => patches/0004-tests-darwin-fixes.patch} (100%) diff --git a/pkgs/by-name/de/deno/package.nix b/pkgs/by-name/de/deno/package.nix index 5ece4a05954e..c3abdb168673 100644 --- a/pkgs/by-name/de/deno/package.nix +++ b/pkgs/by-name/de/deno/package.nix @@ -43,9 +43,17 @@ rustPlatform.buildRustPackage (finalAttrs: { cargoHash = "sha256-ZEWSnath9v04wU1VyFDAx3LANnVhfE5s93jX4QW3XlI="; patches = [ - ./tests-replace-hardcoded-paths.patch - ./tests-darwin-differences.patch - ./tests-no-chown.patch + # Patch out the remote upgrade (deno update) check. + # Not a blocker in the build sandbox, since implementation and tests are + # considerately written for no external networking, but removing brings + # in-line with common nixpkgs practice. + ./patches/0000-remove-deno-upgrade-check.patch + # Patch out the upgrade sub-command since that wouldn't correctly upgrade + # deno from nixpkgs. + ./patches/0001-remove-deno-upgrade.patch + ./patches/0002-tests-replace-hardcoded-paths.patch + ./patches/0003-tests-linux-no-chown.patch + ./patches/0004-tests-darwin-fixes.patch ]; postPatch = '' diff --git a/pkgs/by-name/de/deno/patches/0000-remove-deno-upgrade-check.patch b/pkgs/by-name/de/deno/patches/0000-remove-deno-upgrade-check.patch new file mode 100644 index 000000000000..48e95530ca5c --- /dev/null +++ b/pkgs/by-name/de/deno/patches/0000-remove-deno-upgrade-check.patch @@ -0,0 +1,41 @@ + +diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs +index 3f4bcc8c7..74d5805a3 100644 +--- a/cli/tools/upgrade.rs ++++ b/cli/tools/upgrade.rs +@@ -310,10 +310,7 @@ async fn print_release_notes( + } + + pub fn upgrade_check_enabled() -> bool { +- matches!( +- env::var("DENO_NO_UPDATE_CHECK"), +- Err(env::VarError::NotPresent) +- ) ++ false + } + + pub fn check_for_upgrades( +diff --git a/cli/args/flags.rs b/cli/args/flags.rs +index e1bc861e4..612599c4c 100644 +--- a/cli/args/flags.rs ++++ b/cli/args/flags.rs +@@ -1283,7 +1283,6 @@ static ENV_VARIABLES_HELP: &str = cstr!( + database. + DENO_EMIT_CACHE_MODE Control if the transpiled sources should be cached. + DENO_NO_PACKAGE_JSON Disables auto-resolution of package.json +- DENO_NO_UPDATE_CHECK Set to disable checking if a newer Deno version is available + DENO_SERVE_ADDRESS Override address for Deno.serve + Example: "tcp:0.0.0.0:8080", "unix:/tmp/deno.sock", or "vsock:1234:5678" + DENO_AUTO_SERVE If the entrypoint contains export default { fetch }, `deno run` +diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs +index b342c17f7..1f54292f0 100644 +--- a/tests/integration/upgrade_tests.rs ++++ b/tests/integration/upgrade_tests.rs +@@ -43,6 +43,7 @@ fn upgrade_invalid_lockfile() { + ); + } + ++#[ignore] + #[flaky_test::flaky_test] + fn upgrade_prompt() { + let context = upgrade_context(); diff --git a/pkgs/by-name/de/deno/patches/0001-remove-deno-upgrade.patch b/pkgs/by-name/de/deno/patches/0001-remove-deno-upgrade.patch new file mode 100644 index 000000000000..fa67e84b79de --- /dev/null +++ b/pkgs/by-name/de/deno/patches/0001-remove-deno-upgrade.patch @@ -0,0 +1,73 @@ +diff --git a/cli/args/flags.rs b/cli/args/flags.rs +index e1bc861e4..05f070563 100644 +--- a/cli/args/flags.rs ++++ b/cli/args/flags.rs +@@ -1349,8 +1349,6 @@ static DENO_HELP: &str = cstr!( + test Run tests + deno test | deno test test.ts + publish Publish the current working directory's package or workspace +- upgrade Upgrade deno executable to given version +- deno upgrade | deno upgrade 1.45.0 | deno upgrade canary + {after-help} + + Docs: https://docs.deno.com +@@ -1536,7 +1534,6 @@ pub fn flags_from_vec(args: Vec) -> clap::error::Result { + "types" => types_parse(&mut flags, &mut m), + "uninstall" => uninstall_parse(&mut flags, &mut m), + "update" => outdated_parse(&mut flags, &mut m, true)?, +- "upgrade" => upgrade_parse(&mut flags, &mut m), + "vendor" => vendor_parse(&mut flags, &mut m), + "publish" => publish_parse(&mut flags, &mut m)?, + _ => unreachable!(), +@@ -1797,7 +1794,6 @@ pub fn clap_root() -> Command { + .subcommand(test_subcommand()) + .subcommand(types_subcommand()) + .subcommand(update_subcommand()) +- .subcommand(upgrade_subcommand()) + .subcommand(vendor_subcommand()); + + let help = help_subcommand(&cmd); +@@ -6644,6 +6640,7 @@ mod tests { + assert_eq!(flags2, flags); + } + ++ #[ignore] + #[test] + fn upgrade() { + let r = flags_from_vec(svec!["deno", "upgrade", "--dry-run", "--force"]); +@@ -6665,6 +6662,7 @@ mod tests { + ); + } + ++ #[ignore] + #[test] + fn upgrade_with_output_flag() { + let r = flags_from_vec(svec!["deno", "upgrade", "--output", "example.txt"]); +@@ -10599,6 +10597,7 @@ mod tests { + ); + } + ++ #[ignore] + #[test] + fn upgrade_with_ca_file() { + let r = flags_from_vec(svec!["deno", "upgrade", "--cert", "example.crt"]); +@@ -10620,6 +10619,7 @@ mod tests { + ); + } + ++ #[ignore] + #[test] + fn upgrade_release_candidate() { + let r = flags_from_vec(svec!["deno", "upgrade", "--rc"]); +diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs +index b342c17f7..a6c2aafc6 100644 +--- a/tests/integration/upgrade_tests.rs ++++ b/tests/integration/upgrade_tests.rs +@@ -9,6 +9,7 @@ use test_util::TestContext; + use test_util::assert_starts_with; + use util::TestContextBuilder; + ++#[ignore] + #[flaky_test::flaky_test] + fn upgrade_invalid_lockfile() { + let context = upgrade_context(); diff --git a/pkgs/by-name/de/deno/tests-replace-hardcoded-paths.patch b/pkgs/by-name/de/deno/patches/0002-tests-replace-hardcoded-paths.patch similarity index 100% rename from pkgs/by-name/de/deno/tests-replace-hardcoded-paths.patch rename to pkgs/by-name/de/deno/patches/0002-tests-replace-hardcoded-paths.patch diff --git a/pkgs/by-name/de/deno/tests-no-chown.patch b/pkgs/by-name/de/deno/patches/0003-tests-linux-no-chown.patch similarity index 100% rename from pkgs/by-name/de/deno/tests-no-chown.patch rename to pkgs/by-name/de/deno/patches/0003-tests-linux-no-chown.patch diff --git a/pkgs/by-name/de/deno/tests-darwin-differences.patch b/pkgs/by-name/de/deno/patches/0004-tests-darwin-fixes.patch similarity index 100% rename from pkgs/by-name/de/deno/tests-darwin-differences.patch rename to pkgs/by-name/de/deno/patches/0004-tests-darwin-fixes.patch From cd9882f1779cec3c0ed94e3527a7fdec755bc170 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Fri, 25 Jul 2025 14:56:46 +0100 Subject: [PATCH 2/3] deno: more cleanly concat optional shell completion generation --- pkgs/by-name/de/deno/package.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/de/deno/package.nix b/pkgs/by-name/de/deno/package.nix index c3abdb168673..64ab1a5847d0 100644 --- a/pkgs/by-name/de/deno/package.nix +++ b/pkgs/by-name/de/deno/package.nix @@ -213,13 +213,12 @@ rustPlatform.buildRustPackage (finalAttrs: { postInstall = '' # Remove non-essential binaries like denort and test_server find $out/bin/* -not -name "deno" -delete - - ${lib.optionalString canExecute '' - installShellCompletion --cmd deno \ - --bash <($out/bin/deno completions bash) \ - --fish <($out/bin/deno completions fish) \ - --zsh <($out/bin/deno completions zsh) - ''} + '' + + lib.optionalString canExecute '' + installShellCompletion --cmd deno \ + --bash <($out/bin/deno completions bash) \ + --fish <($out/bin/deno completions fish) \ + --zsh <($out/bin/deno completions zsh) ''; doInstallCheck = canExecute; From ffbcbb029904085c960c6760a327ab28d93d2a62 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Fri, 25 Jul 2025 17:31:40 +0100 Subject: [PATCH 3/3] deno: nixfmt again Formatting seems to have drifted. --- pkgs/by-name/de/deno/package.nix | 101 +++++++++++++++---------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/pkgs/by-name/de/deno/package.nix b/pkgs/by-name/de/deno/package.nix index 64ab1a5847d0..e064cda4a774 100644 --- a/pkgs/by-name/de/deno/package.nix +++ b/pkgs/by-name/de/deno/package.nix @@ -55,20 +55,19 @@ rustPlatform.buildRustPackage (finalAttrs: { ./patches/0003-tests-linux-no-chown.patch ./patches/0004-tests-darwin-fixes.patch ]; - postPatch = - '' - # Use patched nixpkgs libffi in order to fix https://github.com/libffi/libffi/pull/857 - tomlq -ti '.workspace.dependencies.libffi = { "version": .workspace.dependencies.libffi, "features": ["system"] }' Cargo.toml - '' - + - lib.optionalString - (stdenv.hostPlatform.isLinux || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64)) - '' - # LTO crashes with the latest Rust + LLVM combination. - # https://github.com/rust-lang/rust/issues/141737 - # TODO: remove this once LLVM is upgraded to 20.1.7 - tomlq -ti '.profile.release.lto = false' Cargo.toml - ''; + postPatch = '' + # Use patched nixpkgs libffi in order to fix https://github.com/libffi/libffi/pull/857 + tomlq -ti '.workspace.dependencies.libffi = { "version": .workspace.dependencies.libffi, "features": ["system"] }' Cargo.toml + '' + + + lib.optionalString + (stdenv.hostPlatform.isLinux || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64)) + '' + # LTO crashes with the latest Rust + LLVM combination. + # https://github.com/rust-lang/rust/issues/141737 + # TODO: remove this once LLVM is upgraded to 20.1.7 + tomlq -ti '.profile.release.lto = false' Cargo.toml + ''; buildInputs = [ libffi @@ -86,7 +85,8 @@ rustPlatform.buildRustPackage (finalAttrs: { # required by deno_kv crate protobuf installShellFiles - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ lld ]; + ] + ++ 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 @@ -148,48 +148,47 @@ rustPlatform.buildRustPackage (finalAttrs: { # - https://github.com/denoland/deno/blob/2212d7d814914e43f43dfd945ee24197f50fa6fa/tests/Cargo.toml#L25 # - https://github.com/denoland/file_test_runner/blob/9c78319a4e4c6180dde0e9e6c2751017176e65c9/src/collection/mod.rs#L49 ]; - checkFlags = - [ - # Internet access - "--skip=check::ts_no_recheck_on_redirect" - "--skip=js_unit_tests::quic_test" - "--skip=js_unit_tests::net_test" - "--skip=node_unit_tests::http_test" - "--skip=node_unit_tests::http2_test" - "--skip=node_unit_tests::net_test" - "--skip=node_unit_tests::tls_test" - "--skip=npm::lock_file_lock_write" + checkFlags = [ + # Internet access + "--skip=check::ts_no_recheck_on_redirect" + "--skip=js_unit_tests::quic_test" + "--skip=js_unit_tests::net_test" + "--skip=node_unit_tests::http_test" + "--skip=node_unit_tests::http2_test" + "--skip=node_unit_tests::net_test" + "--skip=node_unit_tests::tls_test" + "--skip=npm::lock_file_lock_write" - # GPU access - "--skip=js_unit_tests::webgpu_test" - "--skip=js_unit_tests::jupyter_test" + # GPU access + "--skip=js_unit_tests::webgpu_test" + "--skip=js_unit_tests::jupyter_test" - # Use of /usr/bin - "--skip=specs::permission::proc_self_fd" + # Use of /usr/bin + "--skip=specs::permission::proc_self_fd" - # Flaky - "--skip=init::init_subcommand_serve" - "--skip=serve::deno_serve_parallel" - "--skip=js_unit_tests::stat_test" # timing-sensitive - "--skip=repl::pty_complete_imports" - "--skip=repl::pty_complete_expression" + # Flaky + "--skip=init::init_subcommand_serve" + "--skip=serve::deno_serve_parallel" + "--skip=js_unit_tests::stat_test" # timing-sensitive + "--skip=repl::pty_complete_imports" + "--skip=repl::pty_complete_expression" - # Test hangs, needs investigation - "--skip=repl::pty_complete_imports_no_panic_empty_specifier" + # Test hangs, needs investigation + "--skip=repl::pty_complete_imports_no_panic_empty_specifier" - # Use of VSOCK, might not be available on all platforms - "--skip=js_unit_tests::serve_test" - "--skip=js_unit_tests::fetch_test" - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - # Expects specific shared libraries from macOS to be linked - "--skip=shared_library_tests::macos_shared_libraries" + # Use of VSOCK, might not be available on all platforms + "--skip=js_unit_tests::serve_test" + "--skip=js_unit_tests::fetch_test" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Expects specific shared libraries from macOS to be linked + "--skip=shared_library_tests::macos_shared_libraries" - # Darwin sandbox issues - "--skip=watcher" - "--skip=node_unit_tests::_fs_watch_test" - "--skip=js_unit_tests::fs_events_test" - ]; + # Darwin sandbox issues + "--skip=watcher" + "--skip=node_unit_tests::_fs_watch_test" + "--skip=js_unit_tests::fs_events_test" + ]; __darwinAllowLocalNetworking = true;