Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitwarden-desktop: 2024.6.4 -> 2024.8.0 #330137

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 17 additions & 24 deletions pkgs/by-name/bi/bitwarden-desktop/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, cargo
, copyDesktopItems
, dbus
, electron_29
, electron_31
, fetchFromGitHub
, glib
, gnome-keyring
Expand All @@ -12,7 +12,6 @@
, libsecret
, makeDesktopItem
, makeWrapper
, moreutils
, napi-rs-cli
, nodejs_20
, patchutils_0_4_2
Expand All @@ -26,41 +25,28 @@
let
description = "Secure and free password manager for all of your devices";
icon = "bitwarden";
electron = electron_29;
electron = electron_31;
in buildNpmPackage rec {
pname = "bitwarden-desktop";
version = "2024.6.4";
version = "2024.8.0";

src = fetchFromGitHub {
owner = "bitwarden";
repo = "clients";
rev = "desktop-v${version}";
hash = "sha256-oQ2VZoxePdYUC+xMKlRMpvPubSPULvt31XSh/OBw3Ec=";
hash = "sha256-szIa7fASDmeWKZPc6HtHKeXKerCAXrYZQWTVFMugAxk=";
};

patches = [
./electron-builder-package-lock.patch
];

# The nested package-lock.json from upstream is out-of-date, so copy the
# lock metadata from the root package-lock.json.
postPatch = ''
cat {,apps/desktop/src/}package-lock.json \
| ${lib.getExe jq} -s '
.[1].packages."".dependencies.argon2 = .[0].packages."".dependencies.argon2
| .[0].packages."" = .[1].packages.""
| .[1].packages = .[0].packages
| .[1]
' \
| ${moreutils}/bin/sponge apps/desktop/src/package-lock.json
'';

nodejs = nodejs_20;

makeCacheWritable = true;
npmFlags = [ "--engine-strict" "--legacy-peer-deps" ];
npmWorkspace = "apps/desktop";
npmDepsHash = "sha256-9d9pWrFYelAx/PPDHY3m92Frp8RSQuBqpiOjmWtm/1g=";
npmDepsHash = "sha256-5neEpU7ZhVO5OR181owsvAnFfl7lr0MymvqbRFCPs3M=";

cargoDeps = rustPlatform.fetchCargoTarball {
name = "${pname}-${version}";
Expand All @@ -76,21 +62,23 @@ in buildNpmPackage rec {
patches;
patchFlags = [ "-p4" ];
sourceRoot = "${src.name}/${cargoRoot}";
hash = "sha256-ZmblY1APVa8moAR1waVBZPhrf5Wt1Gi6dvAxkhizckQ=";
hash = "sha256-ya/5z5XpsyuWayziLxuETu/dY8LzZspaAMqL2p8jYN8=";
};
cargoRoot = "apps/desktop/desktop_native";

env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
env = {
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
npm_config_build_from_source = "true";
};

nativeBuildInputs = [
cargo
copyDesktopItems
jq
makeWrapper
moreutils
napi-rs-cli
pkg-config
python3
(python3.withPackages (ps: with ps; [ setuptools ]))
rustc
rustPlatform.cargoCheckHook
rustPlatform.cargoSetupHook
Expand All @@ -107,13 +95,18 @@ in buildNpmPackage rec {
echo 'ERROR: electron version mismatch'
exit 1
fi

pushd apps/desktop/desktop_native/napi
npm run build
popd
'';

postBuild = ''
pushd apps/desktop

# desktop_native/index.js loads a file of that name regarldess of the libc being used
mv desktop_native/desktop_native.* desktop_native/desktop_native.linux-x64-musl.node
ls -al desktop_native/napi
mv desktop_native/napi/desktop_napi.* desktop_native/napi/desktop_napi.linux-x64-musl.node

npm exec electron-builder -- \
--dir \
Expand Down