Skip to content

Commit

Permalink
Merge pull request #274254 from NixOS/backport-273861-to-release-23.11
Browse files Browse the repository at this point in the history
[Backport release-23.11] bitwarden: use Electron 27 instead of 26 to fix bug
  • Loading branch information
NickCao authored Dec 15, 2023
2 parents 40c3c94 + 24b705b commit a7d2dc0
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkgs/tools/security/bitwarden/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, cargo
, copyDesktopItems
, dbus
, electron_26
, electron_27
, fetchFromGitHub
, fetchpatch2
, glib
Expand All @@ -25,10 +25,10 @@
let
description = "A secure and free password manager for all of your devices";
icon = "bitwarden";
electron = electron_26;
electron = electron_27;
in buildNpmPackage rec {
pname = "bitwarden";
version = "2023.12.0"; # TODO add back Electron version check below
version = "2023.12.0";

src = fetchFromGitHub {
owner = "bitwarden";
Expand All @@ -43,13 +43,15 @@ in buildNpmPackage rec {
url = "https://github.com/solopasha/bitwarden_flatpak/raw/daec07b067b9cec5e260b44a53216fc65866ba1d/wayland-clipboard.patch";
hash = "sha256-hcaRa9Nl7MYaTNwmB5Qdm65Mtufv3z+IPwLDPiO3pcw=";
})
# Workaround Electron 25 EOL and 26 has https://github.com/bitwarden/clients/issues/6560
./electron-27.patch
];

nodejs = nodejs_18;

makeCacheWritable = true;
npmWorkspace = "apps/desktop";
npmDepsHash = "sha256-bnYpvHO9Pnob+MbrSshv03mSwXCADH/2xw33nLVKMdg=";
npmDepsHash = "sha256-QwG+D0M94HN1AyQlmzKeScZyksiUr5A9igEaox9DYN4=";

cargoDeps = rustPlatform.fetchCargoTarball {
name = "${pname}-${version}";
Expand Down Expand Up @@ -82,14 +84,12 @@ in buildNpmPackage rec {
libsecret
];

# FIXME add back once upstream moves to Electron >= 26
# we use electron_26 because electron_25 is EOL
/*preBuild = ''
preBuild = ''
if [[ $(jq --raw-output '.devDependencies.electron' < package.json | grep -E --only-matching '^[0-9]+') != ${lib.escapeShellArg (lib.versions.major electron.version)} ]]; then
echo 'ERROR: electron version mismatch'
exit 1
fi
'';*/
'';

postBuild = ''
pushd apps/desktop
Expand Down
69 changes: 69 additions & 0 deletions pkgs/tools/security/bitwarden/electron-27.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From e2c15e826fe9d4d2d12868ef5409e423e3191b58 Mon Sep 17 00:00:00 2001
From: Daniel James Smith <[email protected]>
Date: Fri, 8 Dec 2023 13:07:46 +0100
Subject: [PATCH] Bump electron to v27.1.3 (#7134)

Co-authored-by: Daniel James Smith <[email protected]>

(cherry picked from commit d76602343f36d8e17a9b0204e0290488456c96d5)
---
apps/desktop/electron-builder.json | 2 +-
package-lock.json | 8 ++++----
package.json | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/apps/desktop/electron-builder.json b/apps/desktop/electron-builder.json
index 69d1c0074f..a12870bd96 100644
--- a/apps/desktop/electron-builder.json
+++ b/apps/desktop/electron-builder.json
@@ -19,7 +19,7 @@
"**/node_modules/@bitwarden/desktop-native/index.js",
"**/node_modules/@bitwarden/desktop-native/desktop_native.${platform}-${arch}*.node"
],
- "electronVersion": "25.9.1",
+ "electronVersion": "27.1.3",
"generateUpdatesFilesForAllChannels": true,
"publish": {
"provider": "generic",
diff --git a/package-lock.json b/package-lock.json
index 3f0afde95b..9b7b2dbcd9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -125,7 +125,7 @@
"cross-env": "7.0.3",
"css-loader": "6.8.1",
"del": "6.1.1",
- "electron": "25.9.1",
+ "electron": "27.1.3",
"electron-builder": "23.6.0",
"electron-log": "5.0.0",
"electron-reload": "2.0.0-alpha.1",
@@ -20173,9 +20173,9 @@
}
},
"node_modules/electron": {
- "version": "25.9.1",
- "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.1.tgz",
- "integrity": "sha512-Uo/Fh7igjoUXA/f90iTATZJesQEArVL1uLA672JefNWTLymdKSZkJKiCciu/Xnd0TS6qvdIOUGuJFSTQnKskXQ==",
+ "version": "27.1.3",
+ "resolved": "https://registry.npmjs.org/electron/-/electron-27.1.3.tgz",
+ "integrity": "sha512-7eD8VMhhlL5J531OOawn00eMthUkX1e3qN5Nqd7eMK8bg5HxQBrn8bdPlvUEnCano9KhrVwaDnGeuzWoDOGpjQ==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
diff --git a/package.json b/package.json
index 9ee884b31d..4a5c3513fd 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,7 @@
"cross-env": "7.0.3",
"css-loader": "6.8.1",
"del": "6.1.1",
- "electron": "25.9.1",
+ "electron": "27.1.3",
"electron-builder": "23.6.0",
"electron-log": "5.0.0",
"electron-reload": "2.0.0-alpha.1",
--
2.42.0

0 comments on commit a7d2dc0

Please sign in to comment.