summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2023-10-22 10:32:25 -0700
committerRobert Schütz <nix@dotlambda.de>2023-10-22 13:51:36 -0700
commit33981053289592b9fccc1c491dd385d47be26b90 (patch)
tree7f638f1fa807d95860554802134eca91f01d1b7c
parent5dab9d0ffce42f22bf69b8a8c048cf933f97b1f5 (diff)
downloadnixpkgs-33981053289592b9fccc1c491dd385d47be26b90.tar
nixpkgs-33981053289592b9fccc1c491dd385d47be26b90.tar.gz
nixpkgs-33981053289592b9fccc1c491dd385d47be26b90.tar.bz2
nixpkgs-33981053289592b9fccc1c491dd385d47be26b90.tar.lz
nixpkgs-33981053289592b9fccc1c491dd385d47be26b90.tar.xz
nixpkgs-33981053289592b9fccc1c491dd385d47be26b90.tar.zst
nixpkgs-33981053289592b9fccc1c491dd385d47be26b90.zip
bitwarden: use copyDesktopItems
-rw-r--r--pkgs/tools/security/bitwarden/default.nix30
1 files changed, 17 insertions, 13 deletions
diff --git a/pkgs/tools/security/bitwarden/default.nix b/pkgs/tools/security/bitwarden/default.nix
index ebf019a39d7..84ce6b59d78 100644
--- a/pkgs/tools/security/bitwarden/default.nix
+++ b/pkgs/tools/security/bitwarden/default.nix
@@ -1,7 +1,7 @@
 { lib
-, applyPatches
 , buildNpmPackage
 , cargo
+, copyDesktopItems
 , dbus
 , electron_25
 , fetchFromGitHub
@@ -27,15 +27,6 @@ let
 
   buildNpmPackage' = buildNpmPackage.override { nodejs = nodejs_18; };
   electron = electron_25;
-
-  desktopItem = makeDesktopItem {
-    name = "bitwarden";
-    exec = "bitwarden %U";
-    inherit icon;
-    comment = description;
-    desktopName = "Bitwarden";
-    categories = [ "Utility" ];
-  };
 in buildNpmPackage' rec {
   pname = "bitwarden";
   version = "2023.9.3";
@@ -63,6 +54,7 @@ in buildNpmPackage' rec {
 
   nativeBuildInputs = [
     cargo
+    copyDesktopItems
     jq
     makeWrapper
     moreutils
@@ -128,6 +120,8 @@ in buildNpmPackage' rec {
   '';
 
   installPhase = ''
+    runHook preInstall
+
     mkdir $out
 
     pushd apps/desktop/dist/linux-unpacked
@@ -141,9 +135,6 @@ in buildNpmPackage' rec {
       --set-default ELECTRON_IS_DEV 0 \
       --inherit-argv0
 
-    mkdir -p $out/share/applications
-    cp ${desktopItem}/share/applications/* $out/share/applications
-
     pushd apps/desktop/resources/icons
     for icon in *.png; do
       dir=$out/share/icons/hicolor/"''${icon%.png}"/apps
@@ -151,8 +142,21 @@ in buildNpmPackage' rec {
       cp "$icon" "$dir"/${icon}.png
     done
     popd
+
+    runHook postInstall
   '';
 
+  desktopItems = [
+    (makeDesktopItem {
+      name = "bitwarden";
+      exec = "bitwarden %U";
+      inherit icon;
+      comment = description;
+      desktopName = "Bitwarden";
+      categories = [ "Utility" ];
+    })
+  ];
+
   meta = {
     changelog = "https://github.com/bitwarden/clients/releases/tag/${src.rev}";
     inherit description;