about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/element/element-web.nix
diff options
context:
space:
mode:
authorYureka <yuka@yuka.dev>2022-08-11 19:32:19 +0200
committerYureka <yuka@yuka.dev>2022-08-11 19:43:17 +0200
commitb18abe34031486381206e71b27209480d23de131 (patch)
tree493dc8f97ad1e12a27f4263afc29652ce3d8b1e6 /pkgs/applications/networking/instant-messengers/element/element-web.nix
parente16d071f023c0b3ddd9a50cada69d1f9a916fdad (diff)
element-{web,desktop}: use stdenv.mkDerivation
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/element/element-web.nix')
-rw-r--r--pkgs/applications/networking/instant-messengers/element/element-web.nix22
1 files changed, 13 insertions, 9 deletions
diff --git a/pkgs/applications/networking/instant-messengers/element/element-web.nix b/pkgs/applications/networking/instant-messengers/element/element-web.nix
index 3b43946045985..7ba82ca28f601 100644
--- a/pkgs/applications/networking/instant-messengers/element/element-web.nix
+++ b/pkgs/applications/networking/instant-messengers/element/element-web.nix
@@ -1,5 +1,5 @@
 { lib
-, mkYarnPackage
+, stdenv
 , runCommand
 , fetchFromGitHub
 , fetchYarnDeps
@@ -7,6 +7,7 @@
 , jq
 , yarn
 , fixup_yarn_lock
+, nodejs
 , jitsi-meet
 , conf ? { }
 }:
@@ -19,8 +20,7 @@ let
   };
   configOverrides = writeText "element-config-overrides.json" (builtins.toJSON (noPhoningHome // conf));
 
-in
-mkYarnPackage rec {
+in stdenv.mkDerivation rec {
   pname = "element-web";
   inherit (pinData) version;
 
@@ -31,7 +31,6 @@ mkYarnPackage rec {
     sha256 = pinData.webSrcHash;
   };
 
-  packageJSON = ./element-web-package.json;
   # Remove the matrix-analytics-events dependency from the matrix-react-sdk
   # dependencies list. It doesn't seem to be necessary since we already are
   # installing it individually, and it causes issues with the offline mode.
@@ -43,11 +42,19 @@ mkYarnPackage rec {
     sha256 = pinData.webYarnHash;
   };
 
-  nativeBuildInputs = [ jq ];
+  nativeBuildInputs = [ yarn fixup_yarn_lock jq nodejs ];
 
   configurePhase = ''
     runHook preConfigure
-    ln -s $node_modules node_modules
+
+    export HOME=$PWD/tmp
+    mkdir -p $HOME
+
+    fixup_yarn_lock yarn.lock
+    yarn config --offline set yarn-offline-mirror $offlineCache
+    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
+    patchShebangs node_modules
+
     runHook postConfigure
   '';
 
@@ -72,9 +79,6 @@ mkYarnPackage rec {
     runHook postInstall
   '';
 
-  # Do not attempt generating a tarball for element-web again.
-  doDist = false;
-
   meta = {
     description = "A glossy Matrix collaboration client for the web";
     homepage = "https://element.io/";