nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 pname,
3 version,
4 hash,
5 appimageTools,
6 lib,
7 fetchurl,
8 makeWrapper,
9}:
10
11# Based on https://gist.github.com/msteen/96cb7df66a359b827497c5269ccbbf94 and joplin-desktop nixpkgs.
12let
13 src = fetchurl {
14 url = "https://github.com/Zettlr/Zettlr/releases/download/v${version}/Zettlr-${version}-x86_64.appimage";
15 inherit hash;
16 };
17 appimageContents = appimageTools.extractType2 {
18 inherit pname version src;
19 };
20in
21appimageTools.wrapType2 rec {
22 inherit pname version src;
23
24 extraPkgs = pkgs: [
25 pkgs.texliveMedium
26 pkgs.pandoc
27 ];
28
29 nativeBuildInputs = [ makeWrapper ];
30
31 extraInstallCommands = ''
32 wrapProgram $out/bin/zettlr \
33 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
34 install -m 444 -D ${appimageContents}/Zettlr.desktop $out/share/applications/Zettlr.desktop
35 install -m 444 -D ${appimageContents}/Zettlr.png $out/share/icons/hicolor/512x512/apps/Zettlr.png
36 substituteInPlace $out/share/applications/Zettlr.desktop \
37 --replace-fail 'Exec=AppRun' 'Exec=${pname}'
38 '';
39
40 meta = {
41 description = "Markdown editor for writing academic texts and taking notes";
42 homepage = "https://www.zettlr.com";
43 platforms = [ "x86_64-linux" ];
44 license = lib.licenses.gpl3;
45 maintainers = with lib.maintainers; [ tfmoraes ];
46 mainProgram = "zettlr";
47 };
48}