Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 fetchpatch, 6 xz, 7 dpkg, 8 libxslt, 9 docbook_xsl, 10 makeWrapper, 11 writeShellScript, 12 python3Packages, 13 perlPackages, 14 curl, 15 gnupg, 16 diffutils, 17 nano, 18 pkg-config, 19 bash-completion, 20 help2man, 21 nix-update-script, 22 sendmailPath ? "/run/wrappers/bin/sendmail", 23}: 24 25let 26 inherit (python3Packages) python setuptools; 27 sensible-editor = writeShellScript "sensible-editor" '' 28 exec ''${EDITOR-${nano}/bin/nano} "$@" 29 ''; 30in 31stdenv.mkDerivation (finalAttrs: { 32 pname = "debian-devscripts"; 33 version = "2.25.17"; 34 35 src = fetchFromGitLab { 36 domain = "salsa.debian.org"; 37 owner = "debian"; 38 repo = "devscripts"; 39 tag = "v${finalAttrs.version}"; 40 hash = "sha256-l5FVMg5PEpook9eKdaAnOUlFg7SAas3QC4xF1Spvyf0="; 41 }; 42 43 patches = [ 44 (fetchpatch { 45 name = "hardening-check-obey-binutils-env-vars.patch"; 46 url = "https://github.com/Debian/devscripts/pull/2/commits/c6a018e0ef50a1b0cb4962a2f96dae7c6f21f1d4.patch"; 47 hash = "sha256-UpS239JiAM1IYxNuJLdILq2h0xlR5t0Tzhj47xiMHww="; 48 }) 49 ]; 50 51 postPatch = '' 52 substituteInPlace scripts/debrebuild.pl \ 53 --replace-fail "/usr/bin/perl" "${perlPackages.perl}/bin/perl" 54 patchShebangs scripts 55 '' 56 + 57 # Remove man7 target to avoid missing *.7 file error 58 '' 59 substituteInPlace doc/Makefile \ 60 --replace-fail " install_man7" "" 61 ''; 62 63 nativeBuildInputs = [ 64 makeWrapper 65 pkg-config 66 ]; 67 68 buildInputs = [ 69 xz 70 dpkg 71 libxslt 72 python 73 setuptools 74 curl 75 gnupg 76 diffutils 77 bash-completion 78 help2man 79 ] 80 ++ (with perlPackages; [ 81 perl 82 CryptSSLeay 83 LWP 84 TimeDate 85 DBFile 86 FileDesktopEntry 87 ParseDebControl 88 LWPProtocolHttps 89 Moo 90 FileHomeDir 91 IPCRun 92 FileDirList 93 FileTouch 94 ]); 95 96 preConfigure = '' 97 export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}${dpkg}"; 98 tgtpy="$out/${python.sitePackages}" 99 mkdir -p "$tgtpy" 100 export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$tgtpy" 101 find lib po4a scripts -type f -exec sed -r \ 102 -e "s@/usr/bin/gpg(2|)@${lib.getExe' gnupg "gpg"}@g" \ 103 -e "s@/usr/(s|)bin/sendmail@${sendmailPath}@g" \ 104 -e "s@/usr/bin/diff@${lib.getExe' diffutils "diff"}@g" \ 105 -e "s@/usr/bin/gpgv(2|)@${lib.getExe' gnupg "gpgv"}@g" \ 106 -e "s@(command -v|/usr/bin/)curl@${lib.getExe curl}@g" \ 107 -e "s@sensible-editor@${sensible-editor}@g" \ 108 -e "s@(^|\W)/bin/bash@\1${stdenv.shell}@g" \ 109 -i {} + 110 sed -e "s@/usr/share/sgml/[^ ]*/manpages/docbook.xsl@${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl@" -i scripts/Makefile 111 sed -r \ 112 -e "s@/usr( |$|/)@$out\\1@g" \ 113 -e "s@/etc( |$|/)@$out/etc\\1@g" \ 114 -e 's/ translated_manpages//; s/--install-layout=deb//; s@--root="[^ ]*"@--prefix="'"$out"'"@' \ 115 -i Makefile* */Makefile* 116 ''; 117 118 makeFlags = [ 119 "DESTDIR=$(out)" 120 "PREFIX=" 121 "COMPL_DIR=/share/bash-completion/completions" 122 "PERLMOD_DIR=/share/devscripts" 123 ]; 124 125 postInstall = '' 126 sed -re 's@(^|[ !`"])/bin/bash@\1${stdenv.shell}@g' -i "$out/bin"/* 127 for i in "$out/bin"/*; do 128 wrapProgram "$i" \ 129 --prefix PERL5LIB : "$PERL5LIB" \ 130 --prefix PERL5LIB : "$out/share/devscripts" \ 131 --prefix PYTHONPATH : "$out/${python.sitePackages}" \ 132 --prefix PATH : "${dpkg}/bin" 133 done 134 ln -s debchange $out/bin/dch 135 ln -s pts-subscribe $out/bin/pts-unsubscribe 136 ''; 137 138 passthru.updateScript = nix-update-script { }; 139 140 meta = { 141 description = "Debian package maintenance scripts"; 142 license = lib.licenses.free; # Mix of public domain, Artistic+GPL, GPL1+, GPL2+, GPL3+, and GPL2-only... TODO 143 maintainers = with lib.maintainers; [ raskin ]; 144 platforms = lib.platforms.unix; 145 }; 146})