nixpkgs/pkgs/applications/misc/zettlr/generic.nix
2024-02-11 03:19:15 +01:00

44 lines
1.3 KiB
Nix

{ pname
, version
, hash
, appimageTools
, lib
, fetchurl
, texliveMedium
, pandoc
}:
# Based on https://gist.github.com/msteen/96cb7df66a359b827497c5269ccbbf94 and joplin-desktop nixpkgs.
let
name = "${pname}-${version}";
src = fetchurl {
url = "https://github.com/Zettlr/Zettlr/releases/download/v${version}/Zettlr-${version}-x86_64.appimage";
inherit hash;
};
appimageContents = appimageTools.extractType2 {
inherit name src;
};
in
appimageTools.wrapType2 rec {
inherit name src;
multiArch = false; # no 32bit needed
extraPkgs = pkgs: (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ texliveMedium pandoc ];
extraInstallCommands = ''
mv $out/bin/{${name},${pname}}
install -m 444 -D ${appimageContents}/Zettlr.desktop $out/share/applications/Zettlr.desktop
install -m 444 -D ${appimageContents}/Zettlr.png $out/share/icons/hicolor/512x512/apps/Zettlr.png
substituteInPlace $out/share/applications/Zettlr.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
'';
meta = with lib; {
description = "A markdown editor for writing academic texts and taking notes";
homepage = "https://www.zettlr.com";
platforms = [ "x86_64-linux" ];
license = licenses.gpl3;
maintainers = with maintainers; [ tfmoraes ];
mainProgram = "zettlr";
};
}