summary refs log tree commit diff
path: root/pkgs/tools/security/bitwarden
diff options
context:
space:
mode:
authorAndrew Marshall <andrew@johnandrewmarshall.com>2023-05-09 18:34:50 -0400
committerAndrew Marshall <andrew@johnandrewmarshall.com>2023-05-20 19:30:09 -0400
commitbaecc1d300981a61242e656118cee33ca141fe24 (patch)
tree7817df779ab564ab98b3a5d2202380fad4abd877 /pkgs/tools/security/bitwarden
parent9a8475c634b669680dc1b9e62482c3bf97ff371b (diff)
downloadnixpkgs-baecc1d300981a61242e656118cee33ca141fe24.tar
nixpkgs-baecc1d300981a61242e656118cee33ca141fe24.tar.gz
nixpkgs-baecc1d300981a61242e656118cee33ca141fe24.tar.bz2
nixpkgs-baecc1d300981a61242e656118cee33ca141fe24.tar.lz
nixpkgs-baecc1d300981a61242e656118cee33ca141fe24.tar.xz
nixpkgs-baecc1d300981a61242e656118cee33ca141fe24.tar.zst
nixpkgs-baecc1d300981a61242e656118cee33ca141fe24.zip
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.
Diffstat (limited to 'pkgs/tools/security/bitwarden')
-rw-r--r--pkgs/tools/security/bitwarden/default.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/pkgs/tools/security/bitwarden/default.nix b/pkgs/tools/security/bitwarden/default.nix
index 95351c1b0e1..f3a98cc6d55 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