about summary refs log tree commit diff
path: root/pkgs/development/web/deno
diff options
context:
space:
mode:
author06kellyjac <dev@j-k.io>2021-03-12 11:25:34 +0000
committer06kellyjac <dev@j-k.io>2021-03-12 19:15:56 +0000
commit9611f03177670fad02df91c83f38f53dab31df28 (patch)
treead70c5849c66a92520550763ccefae430dac4e7f /pkgs/development/web/deno
parentdd50d1df59a01ae201bd1536635471a5348ee68a (diff)
deno: make it easier to override librusty_v8
Diffstat (limited to 'pkgs/development/web/deno')
-rw-r--r--pkgs/development/web/deno/default.nix19
-rw-r--r--pkgs/development/web/deno/deps.nix13
-rw-r--r--pkgs/development/web/deno/librusty_v8.nix21
3 files changed, 27 insertions, 26 deletions
diff --git a/pkgs/development/web/deno/default.nix b/pkgs/development/web/deno/default.nix
index 18fd53bd94b71..9951ead02b3a9 100644
--- a/pkgs/development/web/deno/default.nix
+++ b/pkgs/development/web/deno/default.nix
@@ -1,5 +1,6 @@
 { stdenv
 , lib
+, callPackage
 , fetchurl
 , fetchFromGitHub
 , rust
@@ -7,6 +8,7 @@
 , installShellFiles
 , Security
 , CoreServices
+, librusty_v8 ? callPackage ./librusty_v8.nix { }
 }:
 
 rustPlatform.buildRustPackage rec {
@@ -29,25 +31,16 @@ rustPlatform.buildRustPackage rec {
   # The rusty_v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
   # To avoid this we pre-download the file and place it in the locations it will require it in advance
   preBuild =
-    let
-      inherit (import ./deps.nix { }) librusty_v8;
-      arch = rust.toRustTarget stdenv.hostPlatform;
-      librusty_v8_release = fetchurl {
-        url = "https://github.com/denoland/rusty_v8/releases/download/v${librusty_v8.version}/librusty_v8_release_${arch}.a";
-        sha256 = librusty_v8.sha256s.${stdenv.hostPlatform.system};
-        meta = { inherit (librusty_v8) version; };
-      };
-    in
+    let arch = rust.toRustTarget stdenv.hostPlatform; in
     ''
-      _rusty_v8_setup() {
+      _librusty_v8_setup() {
         for v in "$@"; do
-          dir="target/$v/gn_out/obj"
-          mkdir -p "$dir" && cp "${librusty_v8_release}" "$dir/librusty_v8.a"
+          install -D ${librusty_v8} "target/$v/gn_out/obj/librusty_v8.a"
         done
       }
 
       # Copy over the `librusty_v8.a` file inside target/XYZ/gn_out/obj, symlink not allowed
-      _rusty_v8_setup "debug" "release" "${arch}/release"
+      _librusty_v8_setup "debug" "release" "${arch}/release"
     '';
 
   # Tests have some inconsistencies between runs with output integration tests
diff --git a/pkgs/development/web/deno/deps.nix b/pkgs/development/web/deno/deps.nix
deleted file mode 100644
index 3f5846f2a96b6..0000000000000
--- a/pkgs/development/web/deno/deps.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-# auto-generated file -- DO NOT EDIT!
-{}:
-rec {
-  librusty_v8 = {
-    version = "0.20.0";
-    sha256s = {
-      x86_64-linux = "1y0av2hghdvk2qv8kgw29x833wy31i89z7z6hw4jd1y21ihqsdd5";
-      aarch64-linux = "0726ay48w74y79j892is8qxx0kg3m35lmbniwcgy37idxm06vx28";
-      x86_64-darwin = "0gmfdmd5dvxh5xyxsq3nk8fpvdmpczq7nmj1b2zsakl8v3j14jck";
-      aarch64-darwin = "1zw3pxp13s38wspv5lwcns02wzrqagay9zjxj2wiygfzzr5b2c88";
-    };
-  };
-}
diff --git a/pkgs/development/web/deno/librusty_v8.nix b/pkgs/development/web/deno/librusty_v8.nix
new file mode 100644
index 0000000000000..31dbce08922fb
--- /dev/null
+++ b/pkgs/development/web/deno/librusty_v8.nix
@@ -0,0 +1,21 @@
+# auto-generated file -- DO NOT EDIT!
+{ rust, 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";
+    sha256 = args.shas.${stdenv.hostPlatform.system};
+    meta = { inherit (args) version; };
+  };
+in
+fetch_librusty_v8 {
+  version = "0.20.0";
+  shas = {
+    x86_64-linux = "sha256-pTWNYQzChyYJh+afn1AMw/MxUE+Cv4k2FnM3+KDYCvg=";
+    aarch64-linux = "sha256-SPRtQO0tnuEf49GuSsuo403QO0Y6ioRkOp4cjohXRhw=";
+    x86_64-darwin = "sha256-k0kS5NiITqW/WEFWe/Bnt7Z9HZp2YN19L7DvVlptrj4=";
+    aarch64-darwin = "sha256-CDGxSv7fPR+5kF3+5NVTOH8ugLaM07Kv5mjoEW6/g/8=";
+  };
+}