nixpkgs-suyu/pkgs/applications/editors/typora/default.nix

73 lines
1.5 KiB
Nix
Raw Normal View History

2019-09-20 03:18:25 +02:00
{ stdenv
, lib
, fetchurl
, makeWrapper
2020-08-31 06:05:04 +02:00
, electron_9
2019-09-20 03:18:25 +02:00
, dpkg
, gtk3
, glib
, gsettings-desktop-schemas
, wrapGAppsHook
, withPandoc ? false
, pandoc
}:
let
2020-08-31 06:05:04 +02:00
electron = electron_9;
in
stdenv.mkDerivation rec {
pname = "typora";
2021-03-10 01:50:29 +01:00
version = "0.9.98";
src = fetchurl {
url = "https://www.typora.io/linux/typora_${version}_amd64.deb";
2021-03-10 01:50:29 +01:00
sha256 = "sha256-JiqjxT8ZGttrcJrcQmBoGPnRuuYWZ9u2083RxZoLMus=";
};
nativeBuildInputs = [
dpkg
makeWrapper
wrapGAppsHook
];
buildInputs = [
glib
gsettings-desktop-schemas
gtk3
];
2018-05-28 11:55:17 +02:00
2020-07-04 16:25:22 +02:00
# The deb contains setuid permission on `chrome-sandbox`, which will actually not get installed.
unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner";
dontWrapGApps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share
{
cd usr
mv share/typora/resources/app $out/share/typora
mv share/{applications,icons,doc} $out/share/
}
runHook postInstall
'';
postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/typora \
--add-flags $out/share/typora \
2018-05-28 11:55:17 +02:00
"''${gappsWrapperArgs[@]}" \
2019-09-20 03:18:25 +02:00
${lib.optionalString withPandoc ''--prefix PATH : "${lib.makeBinPath [ pandoc ]}"''} \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
'';
2019-09-20 03:18:25 +02:00
meta = with lib; {
description = "A minimal Markdown reading & writing app";
homepage = "https://typora.io";
2017-11-05 18:53:40 +01:00
license = licenses.unfree;
2020-04-25 03:05:59 +02:00
maintainers = with maintainers; [ jensbin ];
2019-08-03 22:49:16 +02:00
platforms = [ "x86_64-linux"];
};
}