bitwarden: make applying patches easier

Since `sourceRoot` occurs before patching, simply setting `patches` in
the native drv to the same as the npm drv doesn’t work, as paths outside
the `sourceRoot` referenced in the patches don’t exist and cause
applying them to fail. Instead, use `applyPatches` to make `src` have
the patches already applied before `sourceRoot` comes into play. It
would be possible to not use `sourceRoot` and just `cd`, but then the
`Cargo.lock` location needs to be manually specified and it just becomes
more mess than it’s worth. `applyPatches` seems the cleanest way to
achieve this.
This commit is contained in:
Andrew Marshall 2023-05-09 18:34:50 -04:00
parent 9a8475c634
commit baecc1d300

View File

@ -1,4 +1,5 @@
{ lib
, applyPatches
, buildNpmPackage
, dbus
, electron
@ -25,21 +26,23 @@ let
buildNpmPackage' = buildNpmPackage.override { nodejs = nodejs_16; };
version = "2023.4.0";
src = fetchFromGitHub {
owner = "bitwarden";
repo = "clients";
rev = "desktop-v${version}";
sha256 = "sha256-TTKDl6Py3k+fAy/kcyiMbAAKQdhVnZTyRXV8D/VpKBE=";
src = applyPatches {
src = fetchFromGitHub {
owner = "bitwarden";
repo = "clients";
rev = "desktop-v${version}";
sha256 = "sha256-TTKDl6Py3k+fAy/kcyiMbAAKQdhVnZTyRXV8D/VpKBE=";
};
patches = [ ];
};
desktop-native = rustPlatform.buildRustPackage {
pname = "bitwarden-desktop-native";
inherit src version;
sourceRoot = "source/apps/desktop/desktop_native";
sourceRoot = "source-patched/apps/desktop/desktop_native";
cargoSha256 = "sha256-VW9DmSh9jvqFCZjH1SAYkydSGjXSVEbv4CmtoJBiw5Y=";
patchFlags = [ "-p4" ];
nativeBuildInputs = [
pkg-config
wrapGAppsHook