nixpkgs/pkgs/tools/compression/xdelta/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

62 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, autoreconfHook
, lzmaSupport ? true, xz ? null
}:
assert lzmaSupport -> xz != null;
let
mkWith = flag: name: if flag
then "--with-${name}"
else "--without-${name}";
in stdenv.mkDerivation rec {
pname = "xdelta";
version = "3.1.0";
src = fetchFromGitHub {
sha256 = "09mmsalc7dwlvgrda56s2k927rpl3a5dzfa88aslkqcjnr790wjy";
rev = "v${version}";
repo = "xdelta-devel";
owner = "jmacd";
};
nativeBuildInputs = [ autoreconfHook ];
buildInputs = []
++ stdenv.lib.optionals lzmaSupport [ xz ];
postPatch = ''
cd xdelta3
'';
configureFlags = [
(mkWith lzmaSupport "liblzma")
];
enableParallelBuilding = true;
doCheck = true;
checkPhase = ''
mkdir $PWD/tmp
for i in testing/file.h xdelta3-test.h; do
substituteInPlace $i --replace /tmp $PWD/tmp
done
./xdelta3regtest
'';
installPhase = ''
install -D -m755 xdelta3 $out/bin/xdelta3
install -D -m644 xdelta3.1 $out/share/man/man1/xdelta3.1
'';
meta = with lib; {
description = "Binary differential compression in VCDIFF (RFC 3284) format";
longDescription = ''
xdelta is a command line program for delta encoding, which generates two
file differences. This is similar to diff and patch, but it is targeted
for binary files and does not generate human readable output.
'';
homepage = "http://xdelta.org/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}