1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{ stdenv
, lib
, fetchurl
, makeWrapper
, electron_9
, dpkg
, gtk3
, glib
, gsettings-desktop-schemas
, wrapGAppsHook
, withPandoc ? false
, pandoc
}:
let
electron = electron_9;
in
stdenv.mkDerivation rec {
pname = "typora";
version = "0.9.95";
src = fetchurl {
url = "https://www.typora.io/linux/typora_${version}_amd64.deb";
sha256 = "0kgzk7z707vlbjrvykrnw2h6wscmc3h5hxycyz1z1j2cz26fns4p";
};
nativeBuildInputs = [
dpkg
makeWrapper
wrapGAppsHook
];
buildInputs = [
glib
gsettings-desktop-schemas
gtk3
];
# 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 \
"''${gappsWrapperArgs[@]}" \
${lib.optionalString withPandoc ''--prefix PATH : "${lib.makeBinPath [ pandoc ]}"''} \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
'';
meta = with lib; {
description = "A minimal Markdown reading & writing app";
homepage = "https://typora.io";
license = licenses.unfree;
maintainers = with maintainers; [ jensbin ];
platforms = [ "x86_64-linux"];
};
}
|