Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / passky-desktop / default.nix
blob927035ed8167d148d8c54c8bcfc789cf5429dec4
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , electron_22
5 , makeWrapper
6 , makeDesktopItem
7 , copyDesktopItems
8 }:
10 stdenv.mkDerivation rec {
11   pname = "passky-desktop";
12   version = "8.1.1";
14   src = fetchFromGitHub {
15     owner = "Rabbit-Company";
16     repo = "Passky-Desktop";
17     rev = "refs/tags/v${version}";
18     sha256 = "1ma8s1bngjdzclcc4m5pcmavk38sidaskmz7dgfnv84y35si18dr";
19   };
21   nativeBuildInputs = [ makeWrapper copyDesktopItems ];
23   installPhase = ''
24     runHook preInstall
26     mkdir -p $out/share/passky
27     cp -r "." "$out/share/passky/electron"
29     local resolution
30     for icon in $out/share/passky/electron/images/icons/icon*.png; do
31       resolution=''${icon%".png"}
32       resolution=''${resolution##*/icon-}
33       mkdir -p "$out/share/icons/hicolor/''${resolution}/apps"
34       ln -s "$icon" "$out/share/icons/hicolor/''${resolution}/apps/passky.png"
35     done
37     mkdir "$out/share/applications"
38     makeWrapper ${electron_22}/bin/electron "$out/bin/passky" \
39       --add-flags "$out/share/passky/electron/" \
40       --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
42     runHook postInstall
43   '';
45   desktopItems = [
46     (
47       makeDesktopItem {
48         name = "Passky";
49         type = "Application";
50         desktopName = "passky";
51         comment = "Simple, modern, open source and secure password manager.";
52         icon = "passky";
53         exec = "passky %U";
54         categories = [ "Utility" ];
55         startupWMClass = "Passky";
56       }
57     )
58   ];
60   meta = with lib; {
61     description = "A simple, modern, lightweight, open source and secure password manager";
62     homepage = "https://passky.org";
63     downloadPage = "https://github.com/Rabbit-Company/Passky-Desktop/releases";
64     changelog = "https://github.com/Rabbit-Company/Passky-Desktop/releases/tag/v${version}";
65     license = licenses.gpl3Only;
66     maintainers = with maintainers; [ akkesm ];
67     mainProgram = "passky";
68     platforms = platforms.unix;
69   };