From 72589c9d30cba3e6b4a2652a477950a0d32f9529 Mon Sep 17 00:00:00 2001 From: Jens Binkert Date: Sat, 20 May 2017 09:52:11 +0200 Subject: [PATCH] Typora: init at 0.9.29 (#25899) * Typora: init at 0.9.29 * typora: adapt description --- pkgs/applications/editors/typora/default.nix | 89 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 91 insertions(+) create mode 100644 pkgs/applications/editors/typora/default.nix diff --git a/pkgs/applications/editors/typora/default.nix b/pkgs/applications/editors/typora/default.nix new file mode 100644 index 000000000000..442a2e2224e4 --- /dev/null +++ b/pkgs/applications/editors/typora/default.nix @@ -0,0 +1,89 @@ +{ stdenv, fetchurl, dpkg, lib, glib, dbus, makeWrapper, gnome2, atk, cairo +, freetype, fontconfig, nspr, nss, xorg, alsaLib, cups, expat, udev }: + +stdenv.mkDerivation rec { + name = "typora-${version}"; + version = "0.9.29"; + + src = + if stdenv.system == "x86_64-linux" then + fetchurl { + url = "https://www.typora.io/linux/typora_${version}_amd64.deb"; + sha256 = "1d7a02ee603be871d6f8c25b5c11069267ec11644a4f513635c0769ce46a44a7"; + } + else + fetchurl { + url = "https://www.typora.io/linux/typora_${version}_i386.deb"; + sha256 = "79834b0ccd2257c030aec850ebc81fe115f46891b482f1ffa41fcc19c5f29659"; + } + ; + + rpath = stdenv.lib.makeLibraryPath [ + alsaLib + gnome2.GConf + gnome2.gtk + gnome2.gdk_pixbuf + gnome2.pango + expat + atk + nspr + nss + stdenv.cc.cc + glib + cairo + cups + dbus + udev + fontconfig + freetype + xorg.libX11 + xorg.libXi + xorg.libXext + xorg.libXtst + xorg.libXfixes + xorg.libXcursor + xorg.libXdamage + xorg.libXrender + xorg.libXrandr + xorg.libXcomposite + xorg.libxcb + xorg.libXScrnSaver + ]; + + + buildInputs = [ dpkg makeWrapper ]; + + unpackPhase = "true"; + installPhase = '' + mkdir -p $out + dpkg -x $src $out + cp -av $out/usr/* $out + rm $out/bin/typora + + # Otherwise it looks "suspicious" + chmod -R g-w $out + ''; + + postFixup = '' + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "$out/share/typora:${rpath}" "$out/share/typora/Typora" + + ln -s "$out/share/typora/Typora" "$out/bin/typora" + + # Fix the desktop link + substituteInPlace $out/share/applications/typora.desktop \ + --replace /usr/bin/ $out/bin/ \ + --replace /usr/share/ $out/share/ + + ''; + + meta = with stdenv.lib; { + description = "A minimal Markdown reading & writing app"; + homepage = "https://typora.io"; + license = licenses.free; + maintainers = with stdenv.lib.maintainers; [ jensbin ]; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; +} + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f5673e260650..2e4d64ff01ce 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15062,6 +15062,8 @@ with pkgs; inherit (gnome3) defaultIconTheme; }; + typora = callPackage ../applications/editors/typora { }; + librep = callPackage ../development/libraries/librep { }; rep-gtk = callPackage ../development/libraries/rep-gtk { };