about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/element/keytar/default.nix')
-rw-r--r--pkgs/applications/networking/instant-messengers/element/keytar/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
new file mode 100644
index 0000000000000..87ef174271dc3
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, nodejs-14_x, python3, callPackage, fixup_yarn_lock, yarn, pkg-config, libsecret }:
+
+stdenv.mkDerivation rec {
+  pname = "keytar";
+  version = "7.7.0";
+
+  src = fetchFromGitHub {
+    owner = "atom";
+    repo = "node-keytar";
+    rev = "v${version}";
+    sha256 = "0ajvr4kjbyw2shb1y14c0dsghdlnq30f19hk2sbzj6n9y3xa3pmi";
+  };
+
+  nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config];
+  buildInputs = [ libsecret ];
+
+  npm_config_nodedir = nodejs-14_x;
+
+  yarnOfflineCache = (callPackage ./yarn.nix {}).offline_cache;
+
+  buildPhase = ''
+    cp ${./yarn.lock} ./yarn.lock
+    chmod u+w . ./yarn.lock
+    export HOME=/tmp
+    yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
+    ${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock
+    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
+    patchShebangs node_modules/
+    node_modules/.bin/node-gyp rebuild
+  '';
+
+  doCheck = false;
+
+  installPhase = ''
+    shopt -s extglob
+    rm -rf node_modules
+    mkdir -p $out
+    cp -r ./!(build) $out
+    install -D -t $out/build/Release build/Release/keytar.node
+  '';
+}