1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pnpm_10,
6 nodejs,
7 electron,
8 makeDesktopItem,
9 copyDesktopItems,
10 imagemagick,
11 makeWrapper,
12 nix-update-script,
13}:
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "gitify";
17 version = "6.5.0";
18
19 src = fetchFromGitHub {
20 owner = "gitify-app";
21 repo = "gitify";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-nFOlzHrtkIYB2shaGnSboqI0HKycTBlu7IkmKwudP5w=";
24 };
25
26 nativeBuildInputs = [
27 nodejs
28 pnpm_10.configHook
29 copyDesktopItems
30 imagemagick
31 makeWrapper
32 ];
33
34 pnpmDeps = pnpm_10.fetchDeps {
35 inherit (finalAttrs) pname version src;
36 fetcherVersion = 1;
37 hash = "sha256-GEUI44QDi1ooq0qXP3lTFp7mVyVJY+TJKv3D1UCe8NI=";
38 };
39
40 env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
41
42 postPatch = ''
43 substituteInPlace config/electron-builder.js \
44 --replace-fail "'Adam Setch (5KD23H9729)'" "null" \
45 --replace-fail "'scripts/afterSign.js'" "null"
46 '';
47
48 buildPhase = ''
49 runHook preBuild
50
51 # electronDist needs to be modifiable on Darwin
52 cp -r ${electron.dist} electron-dist
53 chmod -R u+w electron-dist
54
55 pnpm build
56 pnpm exec electron-builder \
57 --config config/electron-builder.js \
58 --dir \
59 -c.electronDist=electron-dist \
60 -c.electronVersion="${electron.version}" \
61
62 runHook postBuild
63 '';
64
65 installPhase = ''
66 runHook preInstall
67
68 ${
69 if stdenv.hostPlatform.isDarwin then
70 ''
71 mkdir -p $out/Applications
72 cp -r dist/mac*/Gitify.app $out/Applications
73 makeWrapper $out/Applications/Gitify.app/Contents/MacOS/gitify $out/bin/gitify
74 ''
75 else
76 ''
77 mkdir -p $out/share/gitify
78 cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/gitify
79
80 mkdir -p $out/share/icons/hicolor/256x256/apps
81 magick assets/images/app-icon.ico $out/share/icons/hicolor/256x256/apps/gitify.png
82
83 makeWrapper ${lib.getExe electron} $out/bin/gitify \
84 --add-flags $out/share/gitify/resources/app.asar \
85 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
86 --inherit-argv0
87 ''
88 }
89
90 runHook postInstall
91 '';
92
93 desktopItems = [
94 (makeDesktopItem {
95 name = "gitify";
96 desktopName = "Gitify";
97 exec = "gitify %U";
98 icon = "gitify";
99 comment = "GitHub notifications on your menu bar";
100 categories = [ "Development" ];
101 startupWMClass = "Gitify";
102 })
103 ];
104
105 passthru.updateScript = nix-update-script { };
106
107 meta = {
108 homepage = "https://gitify.io/";
109 changelog = "https://github.com/gitify-app/gitify/releases/tag/v${finalAttrs.version}";
110 description = "GitHub notifications on your menu bar";
111 license = lib.licenses.mit;
112 maintainers = with lib.maintainers; [ pineapplehunter ];
113 platforms = lib.platforms.all;
114 };
115})