nerdfonts: fix wrong attribute name in error message (#364463)
[NixPkgs.git] / pkgs / by-name / ca / caprine / package.nix
blob17d78ba28d9b1b2302e736f0ea9ff57c0d3b5cee
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   buildNpmPackage,
6   makeDesktopItem,
7   copyDesktopItems,
8   electron,
9   nix-update-script,
12 buildNpmPackage rec {
13   pname = "caprine";
14   version = "2.60.3";
16   src = fetchFromGitHub {
17     owner = "sindresorhus";
18     repo = "caprine";
19     rev = "v${version}";
20     hash = "sha256-yfCilJ62m7nKe8B+4puwAbNgr2g1P7HaKIhFINdv0/k=";
21   };
23   ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
25   npmDepsHash = "sha256-hNOAplCSXrO4NZqDTkmhf0oZVeGRUHr2Y/Qdx2RIV9c=";
27   nativeBuildInputs = [ copyDesktopItems ];
29   postBuild = ''
30     cp -r ${electron.dist} electron-dist
31     chmod -R u+w electron-dist
33     npm exec electron-builder -- \
34         --dir \
35         -c.npmRebuild=true \
36         -c.asarUnpack="**/*.node" \
37         -c.electronDist=electron-dist \
38         -c.electronVersion=${electron.version}
39   '';
41   patches = [ ./001-disable-auto-update.patch ];
43   installPhase = ''
44     runHook preInstall
46     ${lib.optionalString stdenv.hostPlatform.isLinux ''
47       mkdir -p $out/share/caprine
48       cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/caprine
50       makeWrapper ${lib.getExe electron} $out/bin/caprine \
51           --add-flags $out/share/caprine/resources/app.asar \
52           --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
53           --set-default ELECTRON_IS_DEV 0 \
54           --inherit-argv0
56       install -Dm644 build/icon.png $out/share/icons/hicolor/512x512/apps/caprine.png
57     ''}
59     ${lib.optionalString stdenv.hostPlatform.isDarwin ''
60       mkdir -p $out/Applications
61       cp -r dist/mac*/"Caprine.app" $out/Applications
62       makeWrapper "$out/Applications/Caprine.app/Contents/MacOS/Caprine" $out/bin/caprine
63     ''}
65     runHook postInstall
66   '';
68   desktopItems = [
69     (makeDesktopItem {
70       name = "caprine";
71       exec = "caprine %U";
72       icon = "caprine";
73       desktopName = "Caprine";
74       comment = meta.description;
75       categories = [
76         "Network"
77         "InstantMessaging"
78         "Chat"
79       ];
80       mimeTypes = [ "x-scheme-handler/caprine" ];
81       terminal = false;
82     })
83   ];
85   passthru.updateScript = nix-update-script { };
87   meta = {
88     changelog = "https://github.com/sindresorhus/caprine/releases/tag/${src.rev}";
89     description = "Elegant Facebook Messenger desktop app";
90     homepage = "https://github.com/sindresorhus/caprine";
91     license = lib.licenses.mit;
92     maintainers = with lib.maintainers; [
93       astronaut0212
94       khaneliman
95     ];
96     inherit (electron.meta) platforms;
97   };