61b7cab481
Since 03eaa48
added perl.withPackages, there is a canonical way to
create a perl interpreter from a list of libraries, for use in script
shebangs or generic build inputs. This method is declarative (what we
are doing is clear), produces short shebangs[1] and needs not to wrap
existing scripts.
Unfortunately there are a few exceptions that I've found:
1. Scripts that are calling perl with the -T switch. This makes perl
ignore PERL5LIB, which is what perl.withPackages is using to inform
the interpreter of the library paths.
2. Perl packages that depends on libraries in their own path. This
is not possible because perl.withPackages works at build time. The
workaround is to add `-I $out/${perl.libPrefix}` to the shebang.
In all other cases I propose to switch to perl.withPackages.
[1]: https://lwn.net/Articles/779997/
44 lines
1.2 KiB
Nix
44 lines
1.2 KiB
Nix
{ lib, stdenv, fetchurl, makeWrapper
|
|
, xorg, imlib2, libjpeg, libpng
|
|
, curl, libexif, jpegexiforient, perl
|
|
, enableAutoreload ? !stdenv.hostPlatform.isDarwin }:
|
|
|
|
with lib;
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "feh";
|
|
version = "3.6.3";
|
|
|
|
src = fetchurl {
|
|
url = "https://feh.finalrewind.org/${pname}-${version}.tar.bz2";
|
|
sha256 = "sha256-Q3Qg838RYU4AjQZuKjve/Px4FEyCEpmLK6zdXSHqI7Q=";
|
|
};
|
|
|
|
outputs = [ "out" "man" "doc" ];
|
|
|
|
nativeBuildInputs = [ makeWrapper xorg.libXt ];
|
|
|
|
buildInputs = [ xorg.libX11 xorg.libXinerama imlib2 libjpeg libpng curl libexif ];
|
|
|
|
makeFlags = [
|
|
"PREFIX=${placeholder "out"}" "exif=1"
|
|
] ++ optional stdenv.isDarwin "verscmp=0"
|
|
++ optional enableAutoreload "inotify=1";
|
|
|
|
installTargets = [ "install" ];
|
|
postInstall = ''
|
|
wrapProgram "$out/bin/feh" --prefix PATH : "${makeBinPath [ libjpeg jpegexiforient ]}" \
|
|
--add-flags '--theme=feh'
|
|
'';
|
|
|
|
checkInputs = lib.singleton (perl.withPackages (p: [ p.TestCommand ]));
|
|
doCheck = true;
|
|
|
|
meta = {
|
|
description = "A light-weight image viewer";
|
|
homepage = "https://feh.finalrewind.org/";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ viric willibutz globin ma27 ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|