1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/pkgs/tools/misc/debian-devscripts/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

67 lines
2.3 KiB
Nix

{lib, stdenv, fetchurl, unzip, xz, dpkg
, libxslt, docbook_xsl, makeWrapper
, python3Packages
, perlPackages, curl, gnupg, diffutils
, sendmailPath ? "/run/wrappers/bin/sendmail"
}:
let
inherit (python3Packages) python setuptools;
in stdenv.mkDerivation rec {
version = "2.16.8";
pname = "debian-devscripts";
src = fetchurl {
url = "mirror://debian/pool/main/d/devscripts/devscripts_${version}.tar.xz";
sha256 = "0xy1nvqrnifx46g8ch69pk31by0va6hn10wpi1fkrsrgncanjjh1";
};
buildInputs = [ unzip xz dpkg libxslt python setuptools makeWrapper curl gnupg diffutils ] ++
(with perlPackages; [ perl CryptSSLeay LWP TimeDate DBFile FileDesktopEntry ParseDebControl LWPProtocolHttps ]);
preConfigure = ''
export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}${dpkg}";
tgtpy="$out/lib/${python.libPrefix}/site-packages"
mkdir -p "$tgtpy"
export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$tgtpy"
find po4a scripts -type f -exec sed -r \
-e "s@/usr/bin/gpg(2|)@${gnupg}/bin/gpg@g" \
-e "s@/usr/(s|)bin/sendmail@${sendmailPath}@g" \
-e "s@/usr/bin/diff@${diffutils}/bin/diff@g" \
-e "s@/usr/bin/gpgv(2|)@${gnupg}/bin/gpgv@g" \
-e "s@(command -v|/usr/bin/)curl@${curl.bin}/bin/curl@g" \
-i {} +
sed -e "s@/usr/share/sgml/[^ ]*/manpages/docbook.xsl@${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl@" -i scripts/Makefile
sed -r \
-e "s@/usr( |$|/)@$out\\1@g" \
-e "s@/etc( |$|/)@$out/etc\\1@g" \
-e 's/ translated_manpages//; s/--install-layout=deb//; s@--root="[^ ]*"@--prefix="'"$out"'"@' \
-i Makefile* */Makefile*
'';
makeFlags = [
"DESTDIR=$(out)"
"PREFIX="
"COMPL_DIR=/share/bash-completion/completions"
"PERLMOD_DIR=/share/devscripts"
];
postInstall = ''
sed -re 's@(^|[ !`"])/bin/bash@\1${stdenv.shell}@g' -i "$out/bin"/*
for i in "$out/bin"/*; do
wrapProgram "$i" \
--prefix PERL5LIB : "$PERL5LIB" \
--prefix PERL5LIB : "$out/share/devscripts" \
--prefix PYTHONPATH : "$out/lib/python3.4/site-packages" \
--prefix PATH : "${dpkg}/bin"
done
'';
meta = with lib; {
description = ''Debian package maintenance scripts'';
license = licenses.free; # Mix of public domain, Artistic+GPL, GPL1+, GPL2+, GPL3+, and GPL2-only... TODO
maintainers = with maintainers; [raskin];
platforms = with platforms; linux;
};
}