nixpkgs/pkgs/applications/misc/yarssr/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

65 lines
1.8 KiB
Nix

{ fetchFromGitHub, stdenv, lib, gettext, gtk2, makeWrapper, perlPackages, gnome2 }:
let
perlDeps = with perlPackages; [
Glib Gtk2 Gnome2 Pango Cairo Gnome2Canvas Gnome2VFS Gtk2GladeXML Gtk2TrayIcon
XMLLibXML XMLSAXBase XMLParser XMLRSS
HTMLParser
DateTime DateTimeFormatMail DateTimeFormatW3CDTF DateTimeLocale DateTimeTimeZone
ParamsValidate
ModuleImplementation ModuleRuntime
TryTiny
ClassSingleton
URI
AnyEvent AnyEventHTTP
commonsense
FileSlurp
JSON
Guard
LocaleGettext
];
libs = [
stdenv.cc.cc.lib
gtk2
];
in
stdenv.mkDerivation {
version = "git-2017-12-01";
pname = "yarssr";
src = fetchFromGitHub {
owner = "JGRennison";
repo = "yarssr";
rev = "e70eb9fc6563599bfb91c6de6a79654de531c18d";
sha256 = "0x7hz8x8qyp3i1vb22zhcnvwxm3jhmmmlr22jqc5b09vpmbw1l45";
};
nativeBuildInputs = [ perlPackages.perl gettext makeWrapper ];
buildInputs = perlDeps ++ [gnome2.libglade];
propagatedBuildInputs = libs ++ perlDeps;
installPhase = ''
DESTDIR=$out make install
mv $out/usr/* $out/
rm -R $out/usr
sed -i -r "s!use lib [^;]+;!use lib '$out/share/yarssr';!" $out/bin/yarssr
sed -i -r "s!$Yarssr::PREFIX = [^;]+;!$Yarssr::PREFIX = '$out';!" $out/bin/yarssr
sed -i -r "s!use Yarssr::Browser;!!" $out/share/yarssr/Yarssr/GUI.pm
chmod a+x $out/bin/yarssr
'';
postFixup = ''
wrapProgram $out/bin/yarssr \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath libs} \
--set PERL5LIB "${perlPackages.makePerlPath perlDeps}"
'';
meta = with lib; {
homepage = "https://github.com/tsyrogit/zxcvbn-c";
description = "A fork of Yarssr (a RSS reader for the GNOME Tray) from http://yarssr.sf.net with various fixes";
license = licenses.gpl1;
platforms = platforms.linux;
maintainers = with maintainers; [ xurei ];
};
}