From baecc1d300981a61242e656118cee33ca141fe24 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 9 May 2023 18:34:50 -0400 Subject: [PATCH] bitwarden: make applying patches easier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/tools/security/bitwarden/default.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/security/bitwarden/default.nix b/pkgs/tools/security/bitwarden/default.nix index 95351c1b0e13..f3a98cc6d55f 100644 --- a/pkgs/tools/security/bitwarden/default.nix +++ b/pkgs/tools/security/bitwarden/default.nix @@ -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