|
7 | 7 | wrapGAppsHook3, |
8 | 8 | copyDesktopItems, |
9 | 9 | makeDesktopItem, |
10 | | - |
11 | 10 | # Electron / Chromium runtime libraries |
12 | 11 | alsa-lib, |
13 | 12 | at-spi2-atk, |
|
34 | 33 | pango, |
35 | 34 | systemd, |
36 | 35 | wayland, |
37 | | - xorg, |
38 | | - |
| 36 | + libX11, |
| 37 | + libXcomposite, |
| 38 | + libXcursor, |
| 39 | + libXdamage, |
| 40 | + libXext, |
| 41 | + libXfixes, |
| 42 | + libXi, |
| 43 | + libXrandr, |
| 44 | + libXrender, |
| 45 | + libXScrnSaver, |
| 46 | + libXtst, |
| 47 | + libxcb, |
39 | 48 | commandLineArgs ? "", |
40 | | -}: |
41 | | -let |
| 49 | +}: let |
42 | 50 | releaseData = lib.importJSON ./release-data.json; |
43 | 51 | in |
44 | | -# Packaged from the official prebuilt linux-x64 release tarball rather than built |
45 | | -# from source, so `nix run github:ZenNotes/zennotes` downloads the same signed |
46 | | -# binary the AppImage/deb/AUR ship instead of compiling Electron locally. Bump |
47 | | -# `version` + `desktopHash` in release-data.json per release (see README.md). |
48 | | -stdenv.mkDerivation (finalAttrs: { |
49 | | - pname = "zennotes-desktop"; |
50 | | - inherit (releaseData) version; |
51 | | - |
52 | | - src = fetchurl { |
53 | | - url = "https://github.com/ZenNotes/zennotes/releases/download/v${finalAttrs.version}/ZenNotes-${finalAttrs.version}-linux-x64.tar.gz"; |
54 | | - hash = releaseData.desktopHash; |
55 | | - }; |
56 | | - |
57 | | - sourceRoot = "ZenNotes-${finalAttrs.version}-linux-x64"; |
58 | | - |
59 | | - nativeBuildInputs = [ |
60 | | - autoPatchelfHook |
61 | | - makeWrapper |
62 | | - wrapGAppsHook3 |
63 | | - copyDesktopItems |
64 | | - ]; |
65 | | - |
66 | | - buildInputs = [ |
67 | | - alsa-lib |
68 | | - at-spi2-atk |
69 | | - at-spi2-core |
70 | | - atk |
71 | | - cairo |
72 | | - cups |
73 | | - dbus |
74 | | - expat |
75 | | - fontconfig |
76 | | - freetype |
77 | | - gdk-pixbuf |
78 | | - glib |
79 | | - gtk3 |
80 | | - libdrm |
81 | | - libgbm |
82 | | - libuuid |
83 | | - libxkbcommon |
84 | | - nspr |
85 | | - nss |
86 | | - pango |
87 | | - stdenv.cc.cc # libstdc++ |
88 | | - xorg.libX11 |
89 | | - xorg.libXcomposite |
90 | | - xorg.libXcursor |
91 | | - xorg.libXdamage |
92 | | - xorg.libXext |
93 | | - xorg.libXfixes |
94 | | - xorg.libXi |
95 | | - xorg.libXrandr |
96 | | - xorg.libXrender |
97 | | - xorg.libXScrnSaver |
98 | | - xorg.libXtst |
99 | | - xorg.libxcb |
100 | | - ]; |
101 | | - |
102 | | - # dlopen'd at runtime (not in DT_NEEDED), so keep them on the wrapper's path. |
103 | | - runtimeDependencies = [ |
104 | | - (lib.getLib systemd) |
105 | | - libGL |
106 | | - libnotify |
107 | | - libpulseaudio |
108 | | - wayland |
109 | | - ]; |
110 | | - |
111 | | - dontConfigure = true; |
112 | | - dontBuild = true; |
113 | | - # We invoke makeWrapper manually and splice in gappsWrapperArgs ourselves. |
114 | | - dontWrapGApps = true; |
115 | | - |
116 | | - installPhase = '' |
117 | | - runHook preInstall |
118 | | -
|
119 | | - # The SUID chrome-sandbox can't be made setuid in the Nix store; drop it so |
120 | | - # Electron falls back to the user-namespace sandbox. |
121 | | - rm -f chrome-sandbox |
122 | | -
|
123 | | - mkdir -p $out/share/zennotes |
124 | | - cp -r . $out/share/zennotes |
125 | | -
|
126 | | - # Icons + desktop entry ship inside the tarball's arch-extras tree. |
127 | | - for icon in $out/share/zennotes/resources/arch-extras/icons/*.png; do |
128 | | - size="$(basename "$icon" .png)" |
129 | | - install -Dm644 "$icon" "$out/share/icons/hicolor/$size/apps/${finalAttrs.pname}.png" |
130 | | - done |
131 | | -
|
132 | | - makeWrapper $out/share/zennotes/ZenNotes $out/bin/${finalAttrs.pname} \ |
133 | | - "''${gappsWrapperArgs[@]}" \ |
134 | | - --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto}}" \ |
135 | | - ${lib.optionalString (commandLineArgs != "") "--add-flags ${lib.escapeShellArg commandLineArgs}"} |
136 | | -
|
137 | | - runHook postInstall |
138 | | - ''; |
139 | | - |
140 | | - desktopItems = [ |
141 | | - (makeDesktopItem { |
142 | | - name = finalAttrs.pname; |
143 | | - desktopName = "ZenNotes"; |
144 | | - exec = "${finalAttrs.pname} %U"; |
145 | | - icon = finalAttrs.pname; |
146 | | - comment = "Keyboard-first local Markdown notes"; |
147 | | - categories = [ |
148 | | - "Office" |
149 | | - "Utility" |
150 | | - "TextEditor" |
151 | | - ]; |
152 | | - startupWMClass = "ZenNotes"; |
153 | | - mimeTypes = [ |
154 | | - "text/markdown" |
155 | | - "x-scheme-handler/zennotes" |
156 | | - ]; |
157 | | - }) |
158 | | - ]; |
159 | | - |
160 | | - meta = { |
161 | | - description = "Keyboard-first local Markdown notes with Vim motions, diagrams, and MCP integration (prebuilt binary)"; |
162 | | - homepage = "https://zennotes.org/"; |
163 | | - changelog = "https://github.com/ZenNotes/zennotes/releases/tag/v${finalAttrs.version}"; |
164 | | - license = lib.licenses.mit; |
165 | | - maintainers = with lib.maintainers; [ justkrysteq ]; |
166 | | - mainProgram = finalAttrs.pname; |
167 | | - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; |
168 | | - platforms = [ "x86_64-linux" ]; |
169 | | - }; |
170 | | -}) |
| 52 | + # Packaged from the official prebuilt linux-x64 release tarball rather than built |
| 53 | + # from source, so `nix run github:ZenNotes/zennotes` downloads the same signed |
| 54 | + # binary the AppImage/deb/AUR ship instead of compiling Electron locally. Bump |
| 55 | + # `version` + `desktopHash` in release-data.json per release (see README.md). |
| 56 | + stdenv.mkDerivation (finalAttrs: { |
| 57 | + pname = "zennotes-desktop"; |
| 58 | + inherit (releaseData) version; |
| 59 | + |
| 60 | + src = fetchurl { |
| 61 | + url = "https://github.com/ZenNotes/zennotes/releases/download/v${finalAttrs.version}/ZenNotes-${finalAttrs.version}-linux-x64.tar.gz"; |
| 62 | + hash = releaseData.desktopHash; |
| 63 | + }; |
| 64 | + |
| 65 | + sourceRoot = "ZenNotes-${finalAttrs.version}-linux-x64"; |
| 66 | + |
| 67 | + nativeBuildInputs = [ |
| 68 | + autoPatchelfHook |
| 69 | + makeWrapper |
| 70 | + wrapGAppsHook3 |
| 71 | + copyDesktopItems |
| 72 | + ]; |
| 73 | + |
| 74 | + buildInputs = [ |
| 75 | + alsa-lib |
| 76 | + at-spi2-atk |
| 77 | + at-spi2-core |
| 78 | + atk |
| 79 | + cairo |
| 80 | + cups |
| 81 | + dbus |
| 82 | + expat |
| 83 | + fontconfig |
| 84 | + freetype |
| 85 | + gdk-pixbuf |
| 86 | + glib |
| 87 | + gtk3 |
| 88 | + libdrm |
| 89 | + libgbm |
| 90 | + libuuid |
| 91 | + libxkbcommon |
| 92 | + nspr |
| 93 | + nss |
| 94 | + pango |
| 95 | + stdenv.cc.cc # libstdc++ |
| 96 | + libX11 |
| 97 | + libXcomposite |
| 98 | + libXcursor |
| 99 | + libXdamage |
| 100 | + libXext |
| 101 | + libXfixes |
| 102 | + libXi |
| 103 | + libXrandr |
| 104 | + libXrender |
| 105 | + libXScrnSaver |
| 106 | + libXtst |
| 107 | + libxcb |
| 108 | + ]; |
| 109 | + |
| 110 | + # dlopen'd at runtime (not in DT_NEEDED), so keep them on the wrapper's path. |
| 111 | + runtimeDependencies = [ |
| 112 | + (lib.getLib systemd) |
| 113 | + libGL |
| 114 | + libnotify |
| 115 | + libpulseaudio |
| 116 | + wayland |
| 117 | + ]; |
| 118 | + |
| 119 | + dontConfigure = true; |
| 120 | + dontBuild = true; |
| 121 | + # We invoke makeWrapper manually and splice in gappsWrapperArgs ourselves. |
| 122 | + dontWrapGApps = true; |
| 123 | + |
| 124 | + installPhase = '' |
| 125 | + runHook preInstall |
| 126 | +
|
| 127 | + # The SUID chrome-sandbox can't be made setuid in the Nix store; drop it so |
| 128 | + # Electron falls back to the user-namespace sandbox. |
| 129 | + rm -f chrome-sandbox |
| 130 | +
|
| 131 | + mkdir -p $out/share/zennotes |
| 132 | + cp -r . $out/share/zennotes |
| 133 | +
|
| 134 | + # Icons + desktop entry ship inside the tarball's arch-extras tree. |
| 135 | + for icon in $out/share/zennotes/resources/arch-extras/icons/*.png; do |
| 136 | + size="$(basename "$icon" .png)" |
| 137 | + install -Dm644 "$icon" "$out/share/icons/hicolor/$size/apps/${finalAttrs.pname}.png" |
| 138 | + done |
| 139 | +
|
| 140 | + makeWrapper $out/share/zennotes/ZenNotes $out/bin/${finalAttrs.pname} \ |
| 141 | + "''${gappsWrapperArgs[@]}" \ |
| 142 | + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto}}" \ |
| 143 | + ${lib.optionalString (commandLineArgs != "") "--add-flags ${lib.escapeShellArg commandLineArgs}"} |
| 144 | +
|
| 145 | + runHook postInstall |
| 146 | + ''; |
| 147 | + |
| 148 | + desktopItems = [ |
| 149 | + (makeDesktopItem { |
| 150 | + name = finalAttrs.pname; |
| 151 | + desktopName = "ZenNotes"; |
| 152 | + exec = "${finalAttrs.pname} %U"; |
| 153 | + icon = finalAttrs.pname; |
| 154 | + comment = "Keyboard-first local Markdown notes"; |
| 155 | + categories = [ |
| 156 | + "Office" |
| 157 | + "Utility" |
| 158 | + "TextEditor" |
| 159 | + ]; |
| 160 | + startupWMClass = "ZenNotes"; |
| 161 | + mimeTypes = [ |
| 162 | + "text/markdown" |
| 163 | + "x-scheme-handler/zennotes" |
| 164 | + ]; |
| 165 | + }) |
| 166 | + ]; |
| 167 | + |
| 168 | + meta = { |
| 169 | + description = "Keyboard-first local Markdown notes with Vim motions, diagrams, and MCP integration (prebuilt binary)"; |
| 170 | + homepage = "https://zennotes.org/"; |
| 171 | + changelog = "https://github.com/ZenNotes/zennotes/releases/tag/v${finalAttrs.version}"; |
| 172 | + license = lib.licenses.mit; |
| 173 | + maintainers = with lib.maintainers; [justkrysteq]; |
| 174 | + mainProgram = finalAttrs.pname; |
| 175 | + sourceProvenance = with lib.sourceTypes; [binaryNativeCode]; |
| 176 | + platforms = ["x86_64-linux"]; |
| 177 | + }; |
| 178 | + }) |
0 commit comments