Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 autoreconfHook, 7 testers, 8 mpack, 9}: 10 11stdenv.mkDerivation rec { 12 pname = "mpack"; 13 version = "1.6"; 14 15 src = fetchurl { 16 url = "http://ftp.andrew.cmu.edu/pub/mpack/mpack-${version}.tar.gz"; 17 hash = "sha256-J0EIuzo5mCpO/BT7OmUpjmbI5xNnw9q/STOBYtIHqUw="; 18 }; 19 20 patches = 21 let 22 # https://salsa.debian.org/debian/mpack/-/tree/7d6514b314a7341614ec8275b03acfcb6a854a6f/debian/patches 23 fetchDebPatch = 24 { name, hash }: 25 fetchpatch { 26 inherit name hash; 27 url = "https://salsa.debian.org/debian/mpack/-/raw/7d6514b314a7341614ec8275b03acfcb6a854a6f/debian/patches/${name}"; 28 }; 29 in 30 [ 31 ./sendmail-via-execvp.diff 32 ] 33 ++ (map fetchDebPatch [ 34 { 35 name = "01_legacy.patch"; 36 hash = "sha256-v2pZUXecgxJqoHadBhpAAoferQNSeYE+m7qzEiggeO4="; 37 } 38 { 39 name = "02_fix-permissions.patch"; 40 hash = "sha256-sltnIqgv7+pwwSFQRCDeCwnjoo2OrvmGFm+SM9U/HB4="; 41 } 42 { 43 name = "03_specify-filename-replacement-character.patch"; 44 hash = "sha256-vmLIGFSqKK/qSsltzhdLQGoekew3r25EwAu56umeXlU="; 45 } 46 { 47 name = "04_fix-return-error-code.patch"; 48 hash = "sha256-l23D6xhkgtkEsErzUy/q6U3aPf5N7YUw2PEToU1YXKI="; 49 } 50 { 51 name = "06_fix-makefile.patch"; 52 hash = "sha256-69plDqy2sLzO1O4mqjJIlTRCw5ZeVySiqwo93ZkX3Ho="; 53 } 54 { 55 name = "07_fix-decode-base64-attachment.patch"; 56 hash = "sha256-hzSCrEg0j6dJNLbfwRNn+rWGRnyUBLjJUlORJS9aDD4="; 57 } 58 { 59 name = "08_fix-mime-version.patch"; 60 hash = "sha256-l2rBqbyKmnz5tEPeuX6HCqw7rSV8pDb7ijpCHsdh57g="; 61 } 62 { 63 name = "09_remove-debugging-message.patch"; 64 hash = "sha256-dtq6BHgH4ciho0+TNW/rU3KWoeKs/1jwJafnHTr9ebI="; 65 } 66 ]); 67 68 postPatch = '' 69 substituteInPlace *.{c,man,pl,unix} --replace-quiet /usr/tmp /tmp 70 71 # silence a buffer overflow warning 72 substituteInPlace uudecode.c \ 73 --replace-fail "char buf[1024], buf2[1024];" "char buf[1024], buf2[1066];" 74 ''; 75 76 nativeBuildInputs = [ autoreconfHook ]; 77 78 postInstall = '' 79 install -Dm644 -t $out/share/doc/mpack INSTALL README.* 80 ''; 81 82 enableParallelBuilding = true; 83 84 passthru.tests = { 85 version = testers.testVersion { 86 command = '' 87 mpack 2>&1 || echo "mpack exited with error code $?" 88 ''; 89 package = mpack; 90 version = "mpack version ${version}"; 91 }; 92 }; 93 94 meta = with lib; { 95 description = "Utilities for encoding and decoding binary files in MIME"; 96 license = licenses.free; 97 maintainers = with maintainers; [ tomodachi94 ]; 98 }; 99}