|
1 | 1 | { |
2 | 2 | lib, |
3 | 3 | stdenv, |
| 4 | + binaryen, |
| 5 | + cargo, |
4 | 6 | fetchFromGitHub, |
5 | 7 | fetchYarnDeps, |
6 | 8 | nodejs, |
| 9 | + rustPlatform, |
| 10 | + rustc, |
| 11 | + wasm-bindgen-cli_0_2_106, |
| 12 | + wasm-pack, |
7 | 13 | yarnConfigHook, |
8 | 14 | yarnBuildHook, |
9 | 15 | nix-update-script, |
|
19 | 25 |
|
20 | 26 | stdenv.mkDerivation (finalAttrs: { |
21 | 27 | pname = "ente-web-${enteApp}"; |
22 | | - version = "1.2.18"; |
| 28 | + version = "1.3.13"; |
23 | 29 |
|
24 | 30 | src = fetchFromGitHub { |
25 | 31 | owner = "ente-io"; |
26 | 32 | repo = "ente"; |
27 | | - sparseCheckout = [ "web" ]; |
| 33 | + sparseCheckout = [ |
| 34 | + "rust" |
| 35 | + "web" |
| 36 | + ]; |
28 | 37 | tag = "photos-v${finalAttrs.version}"; |
29 | 38 | fetchSubmodules = true; |
30 | | - hash = "sha256-Ym5pL3UFNSz9Pk179qvTFsFNdIIb3Bs//vscRKV+30Q="; |
| 39 | + hash = "sha256-Bfu4O+kBtXxxVyx2iC/577TPD049ifjg1ItmKN4bx4U="; |
31 | 40 | }; |
32 | 41 | sourceRoot = "${finalAttrs.src.name}/web"; |
33 | 42 |
|
| 43 | + cargoDeps = rustPlatform.fetchCargoVendor { |
| 44 | + inherit (finalAttrs) |
| 45 | + pname |
| 46 | + version |
| 47 | + src |
| 48 | + sourceRoot |
| 49 | + cargoRoot |
| 50 | + ; |
| 51 | + hash = "sha256-dedLmQP15V+gAtycXx1fpWfjXWsTPLXPPcCIAcr/ME0="; |
| 52 | + }; |
| 53 | + cargoRoot = "packages/wasm"; |
| 54 | + |
34 | 55 | offlineCache = fetchYarnDeps { |
35 | 56 | yarnLock = "${finalAttrs.src}/web/yarn.lock"; |
36 | | - hash = "sha256-omFNobZ+2hb1cEO2Gfn+F3oYy7UDSrtIY4cliQ80CUs="; |
| 57 | + hash = "sha256-OPmO+4VlM4Fy9vjgb2ZxDP6Ber9A+ANwix1dZSuEgUE="; |
37 | 58 | }; |
38 | 59 |
|
39 | 60 | nativeBuildInputs = [ |
40 | 61 | yarnConfigHook |
41 | 62 | yarnBuildHook |
| 63 | + binaryen |
| 64 | + cargo |
| 65 | + rustPlatform.cargoSetupHook |
| 66 | + rustc |
| 67 | + rustc.llvmPackages.lld |
42 | 68 | nodejs |
| 69 | + wasm-bindgen-cli_0_2_106 |
| 70 | + wasm-pack |
43 | 71 | ]; |
44 | 72 |
|
45 | 73 | # See: https://github.com/ente-io/ente/blob/main/web/apps/photos/.env |
46 | 74 | env = extraBuildEnv; |
47 | 75 |
|
48 | | - # Replace hardcoded ente.io urls if desired |
49 | | - postPatch = lib.optionalString (enteMainUrl != null) '' |
50 | | - substituteInPlace \ |
51 | | - apps/payments/src/services/billing.ts \ |
52 | | - apps/photos/src/pages/shared-albums.tsx \ |
53 | | - --replace-fail "https://ente.io" ${lib.escapeShellArg enteMainUrl} |
| 76 | + postPatch = |
| 77 | + # Use our `wasm-pack` binary, rather than the Node version, which is |
| 78 | + # just a wrapper that tries to download the actual binary |
| 79 | + '' |
| 80 | + substituteInPlace \ |
| 81 | + packages/wasm/package.json \ |
| 82 | + --replace-fail "wasm-pack " ${lib.escapeShellArg "${wasm-pack}/bin/wasm-pack "} |
| 83 | + '' |
| 84 | + # Replace hardcoded ente.io urls if desired |
| 85 | + + lib.optionalString (enteMainUrl != null) '' |
| 86 | + substituteInPlace \ |
| 87 | + apps/payments/src/services/billing.ts \ |
| 88 | + apps/photos/src/pages/shared-albums.tsx \ |
| 89 | + --replace-fail "https://ente.io" ${lib.escapeShellArg enteMainUrl} |
54 | 90 |
|
55 | | - substituteInPlace \ |
56 | | - apps/accounts/src/pages/index.tsx \ |
57 | | - --replace-fail "https://web.ente.io" ${lib.escapeShellArg enteMainUrl} |
58 | | - ''; |
| 91 | + substituteInPlace \ |
| 92 | + apps/accounts/src/pages/index.tsx \ |
| 93 | + --replace-fail "https://web.ente.io" ${lib.escapeShellArg enteMainUrl} |
| 94 | + ''; |
59 | 95 |
|
60 | 96 | yarnBuildScript = "build:${enteApp}"; |
61 | 97 | installPhase = |
@@ -85,6 +121,7 @@ stdenv.mkDerivation (finalAttrs: { |
85 | 121 | maintainers = with lib.maintainers; [ |
86 | 122 | pinpox |
87 | 123 | oddlama |
| 124 | + nicegamer7 |
88 | 125 | ]; |
89 | 126 | platforms = lib.platforms.all; |
90 | 127 | }; |
|
0 commit comments