summary refs log tree commit diff
path: root/pkgs/development/web/deno
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/web/deno')
-rw-r--r--pkgs/development/web/deno/default.nix21
-rw-r--r--pkgs/development/web/deno/librusty_v8.nix15
-rw-r--r--pkgs/development/web/deno/update/common.ts4
-rw-r--r--pkgs/development/web/deno/update/librusty_v8.ts26
4 files changed, 37 insertions, 29 deletions
diff --git a/pkgs/development/web/deno/default.nix b/pkgs/development/web/deno/default.nix
index f068c3e8d5f..27303fb8602 100644
--- a/pkgs/development/web/deno/default.nix
+++ b/pkgs/development/web/deno/default.nix
@@ -3,6 +3,8 @@
 , callPackage
 , fetchFromGitHub
 , rustPlatform
+, cmake
+, protobuf
 , installShellFiles
 , libiconv
 , darwin
@@ -11,16 +13,16 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "deno";
-  version = "1.36.0";
+  version = "1.38.2";
 
   src = fetchFromGitHub {
     owner = "denoland";
     repo = pname;
     rev = "v${version}";
-    hash = "sha256-PV0Q/OtO4AkY3NMwIQIwU0DCkFqXifJFuHb+Q3rIQLI=";
+    hash = "sha256-DLVeI1pnHpUya8muVUP6VNXiLmlaedOOPPef3tHNOng=";
   };
 
-  cargoHash = "sha256-w0Wr/mwn4Hdfxr7eBdZtpj3MbsMHDwAK2F7XaYEaMCk=";
+  cargoHash = "sha256-qTvPpUBinPm3eQ5PLcqdCcZEG5Q6kGyt35mL914K9jk=";
 
   postPatch = ''
     # upstream uses lld on aarch64-darwin for faster builds
@@ -28,12 +30,23 @@ rustPlatform.buildRustPackage rec {
     substituteInPlace .cargo/config.toml --replace '"-C", "link-arg=-fuse-ld=lld"' ""
   '';
 
-  nativeBuildInputs = [ installShellFiles ];
+  # uses zlib-ng but can't dynamically link yet
+  # https://github.com/rust-lang/libz-sys/issues/158
+  nativeBuildInputs = [
+    # required by libz-ng-sys crate
+    cmake
+    # required by deno_kv crate
+    protobuf
+    installShellFiles
+  ];
   buildInputs = lib.optionals stdenv.isDarwin (
     [ libiconv darwin.libobjc ] ++
     (with darwin.apple_sdk.frameworks; [ Security CoreServices Metal Foundation QuartzCore ])
   );
 
+  # work around "error: unknown warning group '-Wunused-but-set-parameter'"
+  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unknown-warning-option";
+
   buildAndTestSubdir = "cli";
 
   # The v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
diff --git a/pkgs/development/web/deno/librusty_v8.nix b/pkgs/development/web/deno/librusty_v8.nix
index 6e9fc0a669f..e4d2a2fec70 100644
--- a/pkgs/development/web/deno/librusty_v8.nix
+++ b/pkgs/development/web/deno/librusty_v8.nix
@@ -1,21 +1,20 @@
 # auto-generated file -- DO NOT EDIT!
-{ rust, stdenv, fetchurl }:
+{ stdenv, fetchurl }:
 
 let
-  arch = rust.toRustTarget stdenv.hostPlatform;
   fetch_librusty_v8 = args: fetchurl {
     name = "librusty_v8-${args.version}";
-    url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${arch}.a";
+    url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a";
     sha256 = args.shas.${stdenv.hostPlatform.system};
     meta = { inherit (args) version; };
   };
 in
 fetch_librusty_v8 {
-  version = "0.74.3";
+  version = "0.81.0";
   shas = {
-    x86_64-linux = "sha256-8pa8nqA6rbOSBVnp2Q8/IQqh/rfYQU57hMgwU9+iz4A=";
-    aarch64-linux = "sha256-3kXOV8rlCNbNBdXgOtd3S94qO+JIKyOByA4WGX+XVP0=";
-    x86_64-darwin = "sha256-iBBVKZiSoo08YEQ8J/Rt1/5b7a+2xjtuS6QL/Wod5nQ=";
-    aarch64-darwin = "sha256-Djnuc3l/jQKvBf1aej8LG5Ot2wPT0m5Zo1B24l1UHsM=";
+    x86_64-linux = "sha256-e77LYm/sus7EY4eiRuEp6G25djDaT4wSD4FBCxy4vcE=";
+    aarch64-linux = "sha256-wPfUcuT2Z2sy5nLf8xR3QjGQKk6OsM/45jnYv/Hw+Zs=";
+    x86_64-darwin = "sha256-UbnRiywM7b7q3rITZzNeWAuKU+HXXAqVapQ9j5ND6go=";
+    aarch64-darwin = "sha256-42d3VGBv5lW1InfzYfWr6Xj0GpyJ6GWswVNtUa8ID30=";
   };
 }
diff --git a/pkgs/development/web/deno/update/common.ts b/pkgs/development/web/deno/update/common.ts
index 1b4e3509ea7..a31805269cb 100644
--- a/pkgs/development/web/deno/update/common.ts
+++ b/pkgs/development/web/deno/update/common.ts
@@ -48,8 +48,8 @@ export const getLatestVersion = (owner: string, repo: string) =>
 export const genValueRegExp = (key: string, regex: RegExp) =>
   new RegExp(`(?<=${key} = ")(${regex.source}|)(?=")`);
 
-export const logger = (name: string) =>
-  (...a: any) => console.log(`[${name}]`, ...a);
+export const logger = (name: string) => (...a: any) =>
+  console.log(`[${name}]`, ...a);
 
 export const read = Deno.readTextFile;
 export const write = Deno.writeTextFile;
diff --git a/pkgs/development/web/deno/update/librusty_v8.ts b/pkgs/development/web/deno/update/librusty_v8.ts
index d9d57d2908d..39831f6ea27 100644
--- a/pkgs/development/web/deno/update/librusty_v8.ts
+++ b/pkgs/development/web/deno/update/librusty_v8.ts
@@ -1,11 +1,5 @@
-import * as toml from "https://deno.land/std@0.148.0/encoding/toml.ts";
-import {
-  getExistingVersion,
-  logger,
-  run,
-  write,
-} from "./common.ts";
-
+import * as toml from "https://deno.land/std@0.202.0/toml/mod.ts";
+import { getExistingVersion, logger, run, write } from "./common.ts";
 
 const log = logger("librusty_v8");
 
@@ -18,14 +12,14 @@ interface PrefetchResult {
   sha256: string;
 }
 
-const getLibrustyV8Version = async (
+const getCargoLock = async (
   owner: string,
   repo: string,
   version: string,
 ) =>
-  fetch(`https://github.com/${owner}/${repo}/raw/${version}/Cargo.toml`)
+  fetch(`https://github.com/${owner}/${repo}/raw/${version}/Cargo.lock`)
     .then((res) => res.text())
-    .then((txt) => toml.parse(txt).workspace.dependencies.v8.version);
+    .then((txt) => toml.parse(txt));
 
 const fetchArchShaTasks = (version: string, arches: Architecture[]) =>
   arches.map(
@@ -46,13 +40,12 @@ fetchurl {
 
 const templateDeps = (version: string, deps: PrefetchResult[]) =>
   `# auto-generated file -- DO NOT EDIT!
-{ rust, stdenv, fetchurl }:
+{ stdenv, fetchurl }:
 
 let
-  arch = rust.toRustTarget stdenv.hostPlatform;
   fetch_librusty_v8 = args: fetchurl {
     name = "librusty_v8-\${args.version}";
-    url = "https://github.com/denoland/rusty_v8/releases/download/v\${args.version}/librusty_v8_release_\${arch}.a";
+    url = "https://github.com/denoland/rusty_v8/releases/download/v\${args.version}/librusty_v8_release_\${stdenv.hostPlatform.rust.rustcTarget}.a";
     sha256 = args.shas.\${stdenv.hostPlatform.system};
     meta = { inherit (args) version; };
   };
@@ -74,7 +67,10 @@ export async function updateLibrustyV8(
 ) {
   log("Starting librusty_v8 update");
   // 0.0.0
-  const version = await getLibrustyV8Version(owner, repo, denoVersion);
+  const cargoLockData = await getCargoLock(owner, repo, denoVersion);
+  console.log(cargoLockData);
+  const packageItem = cargoLockData.package.find(({ name }) => name === "v8");
+  const version = packageItem.version;
   if (typeof version !== "string") {
     throw "no librusty_v8 version";
   }