Skip to content

Commit

Permalink
bitwarden-desktop: add aarch64-linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
jackoe committed Oct 26, 2024
1 parent d579d17 commit 9c28d1f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkgs/by-name/bi/bitwarden-desktop/package.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ lib
{ stdenv
, lib
, buildNpmPackage
, cargo
, copyDesktopItems
Expand Down Expand Up @@ -93,6 +94,11 @@ in buildNpmPackage rec {
libsecret
];

bitwardenDesktopNativeArch = {
aarch64 = "arm64";
x86_64 = "x64";
}.${stdenv.hostPlatform.parsed.cpu.name} or throw "bitwarden-desktop: unsupported CPU family ${stdenv.hostPlatform.parsed.cpu.name}";

# node-argon2 builds with LTO, but that causes missing symbols. So disable it
# and rebuild. Then we need to copy it into the build output for
# electron-builder, as `apps/desktop/src/package.json` specifies `argon2` as
Expand Down Expand Up @@ -122,7 +128,7 @@ in buildNpmPackage rec {
pushd apps/desktop
# desktop_native/index.js loads a file of that name regarldess of the libc being used
mv desktop_native/napi/desktop_napi.* desktop_native/napi/desktop_napi.linux-x64-musl.node
mv desktop_native/napi/desktop_napi.* desktop_native/napi/desktop_napi.linux-${bitwardenDesktopNativeArch}-musl.node
npm exec electron-builder -- \
--dir \
Expand Down Expand Up @@ -163,7 +169,7 @@ in buildNpmPackage rec {
mkdir $out
pushd apps/desktop/dist/linux-unpacked
pushd apps/desktop/dist/linux-${lib.optionalString stdenv.isAarch64 "arm64-"}unpacked
mkdir -p $out/opt/Bitwarden
cp -r locales resources{,.pak} $out/opt/Bitwarden
popd
Expand Down Expand Up @@ -208,7 +214,7 @@ in buildNpmPackage rec {
homepage = "https://bitwarden.com";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ amarshall ];
platforms = [ "x86_64-linux" ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
mainProgram = "bitwarden";
};
}

0 comments on commit 9c28d1f

Please sign in to comment.