Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl 2, enableStatic ? stdenv.hostPlatform.isStatic 3, writeScript 4}: 5 6# Note: this package is used for bootstrapping fetchurl, and thus 7# cannot use fetchpatch! All mutable patches (generated by GitHub or 8# cgit) that are needed here should be included directly in Nixpkgs as 9# files. 10 11stdenv.mkDerivation rec { 12 pname = "xz"; 13 version = "5.4.3"; 14 15 src = fetchurl { 16 url = "https://tukaani.org/xz/xz-${version}.tar.bz2"; 17 sha256 = "sha256-kkOgRZjXpwwfVnoBQ6JVWBrFxksUD9Vf1cvB4AsOb5A="; 18 }; 19 20 strictDeps = true; 21 outputs = [ "bin" "dev" "out" "man" "doc" ]; 22 23 configureFlags = lib.optional enableStatic "--disable-shared"; 24 25 enableParallelBuilding = true; 26 doCheck = true; 27 28 preCheck = '' 29 # Tests have a /bin/sh dependency... 30 patchShebangs tests 31 ''; 32 33 # In stdenv-linux, prevent a dependency on bootstrap-tools. 34 preConfigure = "CONFIG_SHELL=/bin/sh"; 35 36 postInstall = "rm -rf $out/share/doc"; 37 38 passthru = { 39 updateScript = writeScript "update-xz" '' 40 #!/usr/bin/env nix-shell 41 #!nix-shell -i bash -p curl pcre common-updater-scripts 42 43 set -eu -o pipefail 44 45 # Expect the text in format of '>xz-5.2.6.tar.bz2</a>' 46 # We pick first match where a stable release goes first. 47 new_version="$(curl -s https://tukaani.org/xz/ | 48 pcregrep -o1 '>xz-([0-9.]+)[.]tar[.]bz2</a>' | 49 head -n1)" 50 update-source-version ${pname} "$new_version" 51 ''; 52 }; 53 54 meta = with lib; { 55 homepage = "https://tukaani.org/xz/"; 56 description = "A general-purpose data compression software, successor of LZMA"; 57 58 longDescription = 59 '' XZ Utils is free general-purpose data compression software with high 60 compression ratio. XZ Utils were written for POSIX-like systems, 61 but also work on some not-so-POSIX systems. XZ Utils are the 62 successor to LZMA Utils. 63 64 The core of the XZ Utils compression code is based on LZMA SDK, but 65 it has been modified quite a lot to be suitable for XZ Utils. The 66 primary compression algorithm is currently LZMA2, which is used 67 inside the .xz container format. With typical files, XZ Utils 68 create 30 % smaller output than gzip and 15 % smaller output than 69 bzip2. 70 ''; 71 72 license = with licenses; [ gpl2Plus lgpl21Plus ]; 73 maintainers = with maintainers; [ sander ]; 74 platforms = platforms.all; 75 }; 76}