2019-09-20 02:18:25 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2020-08-31 05:05:04 +01:00
|
|
|
, electron_9
|
2019-09-20 02:18:25 +01:00
|
|
|
, dpkg
|
|
|
|
, gtk3
|
|
|
|
, glib
|
|
|
|
, gsettings-desktop-schemas
|
|
|
|
, wrapGAppsHook
|
|
|
|
, withPandoc ? false
|
|
|
|
, pandoc
|
|
|
|
}:
|
2017-05-20 08:52:11 +01:00
|
|
|
|
2020-05-22 17:25:35 +01:00
|
|
|
let
|
2020-08-31 05:05:04 +01:00
|
|
|
electron = electron_9;
|
2020-05-22 17:25:35 +01:00
|
|
|
in
|
2017-05-20 08:52:11 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-01-28 22:13:37 +00:00
|
|
|
pname = "typora";
|
2020-08-31 05:05:04 +01:00
|
|
|
version = "0.9.95";
|
2017-05-20 08:52:11 +01:00
|
|
|
|
2019-01-28 22:13:37 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.typora.io/linux/typora_${version}_amd64.deb";
|
2020-08-31 05:05:04 +01:00
|
|
|
sha256 = "0kgzk7z707vlbjrvykrnw2h6wscmc3h5hxycyz1z1j2cz26fns4p";
|
2019-01-28 22:13:37 +00:00
|
|
|
};
|
2017-05-20 08:52:11 +01:00
|
|
|
|
2019-03-31 02:44:58 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
dpkg
|
|
|
|
makeWrapper
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
2017-05-20 08:52:11 +01:00
|
|
|
|
2019-03-31 02:44:58 +01:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
gsettings-desktop-schemas
|
|
|
|
gtk3
|
|
|
|
];
|
2018-05-28 10:55:17 +01:00
|
|
|
|
2020-07-04 15:25:22 +01: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";
|
2017-05-20 08:52:11 +01:00
|
|
|
|
2019-01-28 22:13:37 +00:00
|
|
|
dontWrapGApps = true;
|
2017-05-20 08:52:11 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2019-03-31 02:44:58 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/bin $out/share
|
2019-01-28 22:13:37 +00:00
|
|
|
{
|
|
|
|
cd usr
|
2019-03-31 02:44:58 +01:00
|
|
|
mv share/typora/resources/app $out/share/typora
|
|
|
|
mv share/{applications,icons,doc} $out/share/
|
2019-01-28 22:13:37 +00:00
|
|
|
}
|
|
|
|
|
2019-03-31 02:44:58 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
2020-05-22 17:25:35 +01:00
|
|
|
makeWrapper ${electron}/bin/electron $out/bin/typora \
|
2019-01-28 22:13:37 +00:00
|
|
|
--add-flags $out/share/typora \
|
2018-05-28 10:55:17 +01:00
|
|
|
"''${gappsWrapperArgs[@]}" \
|
2019-09-20 02:18:25 +01:00
|
|
|
${lib.optionalString withPandoc ''--prefix PATH : "${lib.makeBinPath [ pandoc ]}"''} \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
|
2017-05-20 08:52:11 +01:00
|
|
|
'';
|
|
|
|
|
2019-09-20 02:18:25 +01:00
|
|
|
meta = with lib; {
|
2017-05-20 08:52:11 +01:00
|
|
|
description = "A minimal Markdown reading & writing app";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://typora.io";
|
2017-11-05 17:53:40 +00:00
|
|
|
license = licenses.unfree;
|
2020-04-25 02:05:59 +01:00
|
|
|
maintainers = with maintainers; [ jensbin ];
|
2019-08-03 21:49:16 +01:00
|
|
|
platforms = [ "x86_64-linux"];
|
2017-05-20 08:52:11 +01:00
|
|
|
};
|
|
|
|
}
|