|
| 1 | +{ stdenv, fetchurl, dpkg, lib, glib, dbus, makeWrapper, gnome2, atk, cairo |
| 2 | +, freetype, fontconfig, nspr, nss, xorg, alsaLib, cups, expat, udev }: |
| 3 | + |
| 4 | +stdenv.mkDerivation rec { |
| 5 | + name = "typora-${version}"; |
| 6 | + version = "0.9.29"; |
| 7 | + |
| 8 | + src = |
| 9 | + if stdenv.system == "x86_64-linux" then |
| 10 | + fetchurl { |
| 11 | + url = "https://www.typora.io/linux/typora_${version}_amd64.deb"; |
| 12 | + sha256 = "1d7a02ee603be871d6f8c25b5c11069267ec11644a4f513635c0769ce46a44a7"; |
| 13 | + } |
| 14 | + else |
| 15 | + fetchurl { |
| 16 | + url = "https://www.typora.io/linux/typora_${version}_i386.deb"; |
| 17 | + sha256 = "79834b0ccd2257c030aec850ebc81fe115f46891b482f1ffa41fcc19c5f29659"; |
| 18 | + } |
| 19 | + ; |
| 20 | + |
| 21 | + rpath = stdenv.lib.makeLibraryPath [ |
| 22 | + alsaLib |
| 23 | + gnome2.GConf |
| 24 | + gnome2.gtk |
| 25 | + gnome2.gdk_pixbuf |
| 26 | + gnome2.pango |
| 27 | + expat |
| 28 | + atk |
| 29 | + nspr |
| 30 | + nss |
| 31 | + stdenv.cc.cc |
| 32 | + glib |
| 33 | + cairo |
| 34 | + cups |
| 35 | + dbus |
| 36 | + udev |
| 37 | + fontconfig |
| 38 | + freetype |
| 39 | + xorg.libX11 |
| 40 | + xorg.libXi |
| 41 | + xorg.libXext |
| 42 | + xorg.libXtst |
| 43 | + xorg.libXfixes |
| 44 | + xorg.libXcursor |
| 45 | + xorg.libXdamage |
| 46 | + xorg.libXrender |
| 47 | + xorg.libXrandr |
| 48 | + xorg.libXcomposite |
| 49 | + xorg.libxcb |
| 50 | + xorg.libXScrnSaver |
| 51 | + ]; |
| 52 | + |
| 53 | + |
| 54 | + buildInputs = [ dpkg makeWrapper ]; |
| 55 | + |
| 56 | + unpackPhase = "true"; |
| 57 | + installPhase = '' |
| 58 | + mkdir -p $out |
| 59 | + dpkg -x $src $out |
| 60 | + cp -av $out/usr/* $out |
| 61 | + rm $out/bin/typora |
| 62 | +
|
| 63 | + # Otherwise it looks "suspicious" |
| 64 | + chmod -R g-w $out |
| 65 | + ''; |
| 66 | + |
| 67 | + postFixup = '' |
| 68 | + patchelf \ |
| 69 | + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ |
| 70 | + --set-rpath "$out/share/typora:${rpath}" "$out/share/typora/Typora" |
| 71 | +
|
| 72 | + ln -s "$out/share/typora/Typora" "$out/bin/typora" |
| 73 | +
|
| 74 | + # Fix the desktop link |
| 75 | + substituteInPlace $out/share/applications/typora.desktop \ |
| 76 | + --replace /usr/bin/ $out/bin/ \ |
| 77 | + --replace /usr/share/ $out/share/ |
| 78 | +
|
| 79 | + ''; |
| 80 | + |
| 81 | + meta = with stdenv.lib; { |
| 82 | + description = "A minimal Markdown reading & writing app"; |
| 83 | + homepage = "https://typora.io"; |
| 84 | + license = licenses.free; |
| 85 | + maintainers = with stdenv.lib.maintainers; [ jensbin ]; |
| 86 | + platforms = [ "x86_64-linux" "i686-linux" ]; |
| 87 | + }; |
| 88 | +} |
| 89 | + |
0 commit comments