Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at github-to-sqlite-beautifulsoup4 116 lines 3.2 kB view raw
1{ lib 2, stdenv 3, callPackage 4, fetchFromGitHub 5, cmake 6, cppunit 7, pkg-config 8, curl 9, fuse 10, libkrb5 11, libuuid 12, libxcrypt 13, libxml2 14, openssl 15, readline 16, systemd 17, voms 18, zlib 19 # Build bin/test-runner 20, enableTestRunner ? true 21 # If not null, the builder will 22 # move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc. 23, externalEtc ? "/etc" 24}: 25 26stdenv.mkDerivation (finalAttrs: { 27 pname = "xrootd"; 28 version = "5.5.5"; 29 30 src = fetchFromGitHub { 31 owner = "xrootd"; 32 repo = "xrootd"; 33 rev = "v${finalAttrs.version}"; 34 fetchSubmodules = true; 35 hash = "sha256-SLmxv8opN7z4V07S9kLGo8HG7Ql62iZQLtf3zGemwA8="; 36 }; 37 38 outputs = [ "bin" "out" "dev" "man" ]; 39 40 passthru.fetchxrd = callPackage ./fetchxrd.nix { xrootd = finalAttrs.finalPackage; }; 41 passthru.tests = 42 lib.optionalAttrs stdenv.hostPlatform.isLinux { 43 test-runner = callPackage ./test-runner.nix { xrootd = finalAttrs.finalPackage; }; 44 } // { 45 test-xrdcp = finalAttrs.passthru.fetchxrd { 46 pname = "xrootd-test-xrdcp"; 47 # Use the the bin output hash of xrootd as version to ensure that 48 # the test gets rebuild everytime xrootd gets rebuild 49 version = finalAttrs.version + "-" + builtins.substring (builtins.stringLength builtins.storeDir + 1) 32 "${finalAttrs.finalPackage}"; 50 url = "root://eospublic.cern.ch//eos/opendata/alice/2010/LHC10h/000138275/ESD/0000/AliESDs.root"; 51 hash = "sha256-tIcs2oi+8u/Qr+P7AAaPTbQT+DEt26gEdc4VNerlEHY="; 52 }; 53 } 54 ; 55 56 nativeBuildInputs = [ 57 cmake 58 pkg-config 59 ]; 60 61 buildInputs = [ 62 curl 63 libkrb5 64 libuuid 65 libxcrypt 66 libxml2 67 openssl 68 readline 69 zlib 70 fuse 71 ] 72 ++ lib.optionals stdenv.isLinux [ 73 systemd 74 voms 75 ] 76 ++ lib.optionals enableTestRunner [ 77 cppunit 78 ]; 79 80 preConfigure = '' 81 patchShebangs genversion.sh 82 ''; 83 84 # https://github.com/xrootd/xrootd/blob/master/packaging/rhel/xrootd.spec.in#L665-L675= 85 postInstall = '' 86 mkdir -p "$out/lib/tmpfiles.d" 87 install -m 644 -T ../packaging/rhel/xrootd.tmpfiles "$out/lib/tmpfiles.d/xrootd.conf" 88 mkdir -p "$out/etc/xrootd" 89 install -m 644 -t "$out/etc/xrootd" ../packaging/common/*.cfg 90 install -m 644 -t "$out/etc/xrootd" ../packaging/common/client.conf 91 mkdir -p "$out/etc/xrootd/client.plugins.d" 92 install -m 644 -t "$out/etc/xrootd/client.plugins.d" ../packaging/common/client-plugin.conf.example 93 mkdir -p "$out/etc/logrotate.d" 94 install -m 644 -T ../packaging/common/xrootd.logrotate "$out/etc/logrotate.d/xrootd" 95 '' + lib.optionalString stdenv.isLinux '' 96 mkdir -p "$out/lib/systemd/system" 97 install -m 644 -t "$out/lib/systemd/system" ../packaging/common/*.service ../packaging/common/*.socket 98 ''; 99 100 cmakeFlags = lib.optionals enableTestRunner [ 101 "-DENABLE_TESTS=TRUE" 102 ]; 103 104 postFixup = lib.optionalString (externalEtc != null) '' 105 mv "$out"/etc{,.orig} 106 ln -s ${lib.escapeShellArg externalEtc} "$out/etc" 107 ''; 108 109 meta = with lib; { 110 description = "High performance, scalable fault tolerant data access"; 111 homepage = "https://xrootd.slac.stanford.edu"; 112 license = licenses.lgpl3Plus; 113 platforms = platforms.all; 114 maintainers = with maintainers; [ ShamrockLee ]; 115 }; 116})