nixpkgs/pkgs/applications/editors/lighttable/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

66 lines
2.2 KiB
Nix

{ stdenv, lib, fetchurl, zlib, glib, alsaLib, makeDesktopItem
, dbus, gtk2, atk, pango, freetype, fontconfig, libgnome-keyring3, gdk-pixbuf
, cairo, cups, expat, libgpgerror, nspr, gnome2, nss, xorg, systemd, libnotify
}:
let
libPath = stdenv.lib.makeLibraryPath [
stdenv.cc.cc zlib glib dbus gtk2 atk pango freetype libgnome-keyring3 nss
fontconfig gdk-pixbuf cairo cups expat libgpgerror alsaLib nspr gnome2.GConf
xorg.libXrender xorg.libX11 xorg.libXext xorg.libXdamage xorg.libXtst
xorg.libXcomposite xorg.libXi xorg.libXfixes libnotify xorg.libXrandr
xorg.libXcursor
];
desktopItem = makeDesktopItem {
name = "LightTable";
exec = "light";
comment = "LightTable";
desktopName = "LightTable";
genericName = "the next generation code editor";
};
in
stdenv.mkDerivation rec {
pname = "lighttable";
version = "0.8.1";
src =
fetchurl {
name = "LightTableLinux64.tar.gz";
url = "https://github.com/LightTable/LightTable/releases/download/${version}/${pname}-${version}-linux.tar.gz";
sha256 = "06fj725xfhf3fwrf7dya7ijmxq3v76kfmd4lr2067a92zhlwr5pv";
};
phases = [ "installPhase" ];
installPhase = ''
tar xf ${src}
mkdir -p $out/{bin,share/LightTable}
mv ./${pname}-${version}-linux/* $out/share/LightTable
patchelf \
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath ${libPath}:${libPath}/lib64:$out/share/LightTable \
$out/share/LightTable/LightTable
mv $out/share/LightTable/light $out/bin/light
ln -sf ${lib.getLib systemd}/lib/libudev.so.1 $out/share/LightTable/libudev.so.0
substituteInPlace $out/bin/light \
--replace "/usr/lib/x86_64-linux-gnu" "${lib.getLib systemd}/lib" \
--replace "/lib/x86_64-linux-gnu" "$out/share/LightTable" \
--replace 'HERE=`dirname $(readlink -f $0)`' "HERE=$out/share/LightTable"
mkdir -p "$out"/share/applications
cp "${desktopItem}/share/applications/LightTable.desktop" "$out"/share/applications/
'';
meta = with lib; {
description = "The next generation code editor";
homepage = "http://www.lighttable.com/";
license = licenses.gpl3;
maintainers = [ maintainers.matejc ];
platforms = [ "x86_64-linux" ];
};
}