mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 14:41:17 +00:00
4a7f99d55d
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
51 lines
1.5 KiB
Nix
51 lines
1.5 KiB
Nix
{lib, stdenv, fetchurl, unzip, python, makeWrapper, ghostscript, pngnq, pillow, djvulibre
|
|
, optipng, unrar}:
|
|
|
|
stdenv.mkDerivation {
|
|
name = "pdfread-1.8.2";
|
|
|
|
src = fetchurl {
|
|
# I got it from http://www.mobileread.com/forums/showthread.php?t=21906
|
|
# But that needs user registration to allow downloading.
|
|
# This is an evolution from pdfread 1.7 in http://pdfread.sourceforge.net/
|
|
# Temporary place:
|
|
url = "http://vicerveza.homeunix.net/~viric/soft/PDFRead-1.8.2-Source-noGUI-noInstaller.zip";
|
|
sha256 = "0mzxpnk97f0ww5ds7h4wsval3g4lnrhv6rhspjs7cy4i41gmk8an";
|
|
};
|
|
|
|
buildInputs = [ unzip python makeWrapper ];
|
|
|
|
broken = true; # Not found.
|
|
|
|
phases = "unpackPhase patchPhase installPhase";
|
|
|
|
unpackPhase = ''
|
|
unzip $src
|
|
sourceRoot=`pwd`/PDFRead/src
|
|
'';
|
|
|
|
patchPhase = ''
|
|
sed -i 's,#!/usr.*,#!${python}/bin/python,' pdfread.py
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp pdfread.py $out/bin
|
|
chmod +x $out/bin/pdfread.py
|
|
|
|
LIBSUFFIX=lib/${python.libPrefix}/site-packages/
|
|
PYDIR=$out/$LIBSUFFIX
|
|
mkdir -p $PYDIR
|
|
cp -R *.py pylrs $PYDIR
|
|
|
|
wrapProgram $out/bin/pdfread.py --prefix PYTHONPATH : $PYTHONPATH:${pillow}/$LIBSUFFIX/PIL:$PYDIR \
|
|
--prefix PATH : ${stdenv.lib.makeBinPath [ ghostscript pngnq djvulibre unrar optipng ]}
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "PDF/DJVU to ebook format converter";
|
|
homepage = "https://www.mobileread.com/forums/showthread.php?t=21906";
|
|
license = licenses.mit;
|
|
};
|
|
}
|