23 # Build bin/test-runner
24 , enableTestRunner ? true
25 # If not null, the builder will
26 # move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc.
27 , externalEtc ? "/etc"
31 stdenv.mkDerivation (finalAttrs: {
35 src = fetchFromGitHub {
38 rev = "v${finalAttrs.version}";
39 fetchSubmodules = true;
40 hash = "sha256-vSZKTsDMY5bhfniFOQ11VA30gjfb4Y8tCC7JNjNw8Y0=";
43 outputs = [ "bin" "out" "dev" "man" ]
44 ++ lib.optional (externalEtc != null) "etc";
46 passthru.fetchxrd = callPackage ./fetchxrd.nix { xrootd = finalAttrs.finalPackage; };
48 lib.optionalAttrs stdenv.hostPlatform.isLinux {
49 test-runner = callPackage ./test-runner.nix { xrootd = finalAttrs.finalPackage; };
51 test-xrdcp = finalAttrs.passthru.fetchxrd {
52 pname = "xrootd-test-xrdcp";
53 # Use the the bin output hash of xrootd as version to ensure that
54 # the test gets rebuild everytime xrootd gets rebuild
55 version = finalAttrs.version + "-" + builtins.substring (builtins.stringLength builtins.storeDir + 1) 32 "${finalAttrs.finalPackage}";
56 url = "root://eospublic.cern.ch//eos/opendata/alice/2010/LHC10h/000138275/ESD/0000/AliESDs.root";
57 hash = "sha256-tIcs2oi+8u/Qr+P7AAaPTbQT+DEt26gEdc4VNerlEHY=";
81 ++ lib.optionals (!stdenv.isDarwin) [
82 # https://github.com/xrootd/xrootd/blob/5b5a1f6957def2816b77ec773c7e1bfb3f1cfc5b/cmake/XRootDFindLibs.cmake#L58
85 ++ lib.optionals stdenv.isLinux [
89 ++ lib.optionals enableTestRunner [
95 patchShebangs genversion.sh
96 substituteInPlace cmake/XRootDConfig.cmake.in \
97 --replace-fail "@PACKAGE_CMAKE_INSTALL_" "@CMAKE_INSTALL_FULL_"
98 '' + lib.optionalString stdenv.isDarwin ''
99 sed -i cmake/XRootDOSDefs.cmake -e '/set( MacOSX TRUE )/ainclude( GNUInstallDirs )'
102 # https://github.com/xrootd/xrootd/blob/master/packaging/rhel/xrootd.spec.in#L665-L675=
104 mkdir -p "$out/lib/tmpfiles.d"
105 install -m 644 -T ../packaging/rhel/xrootd.tmpfiles "$out/lib/tmpfiles.d/xrootd.conf"
106 mkdir -p "$out/etc/xrootd"
107 install -m 644 -t "$out/etc/xrootd" ../packaging/common/*.cfg
108 install -m 644 -t "$out/etc/xrootd" ../packaging/common/client.conf
109 mkdir -p "$out/etc/xrootd/client.plugins.d"
110 install -m 644 -t "$out/etc/xrootd/client.plugins.d" ../packaging/common/client-plugin.conf.example
111 mkdir -p "$out/etc/logrotate.d"
112 install -m 644 -T ../packaging/common/xrootd.logrotate "$out/etc/logrotate.d/xrootd"
114 # Leaving those in bin/ leads to a cyclic reference between $dev and $bin
115 # This happens since https://github.com/xrootd/xrootd/commit/fe268eb622e2192d54a4230cea54c41660bd5788
116 # So far, this xrootd-config script does not seem necessary in $bin
118 moveToOutput "bin/xrootd-config" "$dev"
119 moveToOutput "bin/.xrootd-config-wrapped" "$dev"
120 '' + lib.optionalString stdenv.isLinux ''
121 mkdir -p "$out/lib/systemd/system"
122 install -m 644 -t "$out/lib/systemd/system" ../packaging/common/*.service ../packaging/common/*.socket
126 "-DXRootD_VERSION_STRING=${finalAttrs.version}"
127 ] ++ lib.optionals enableTestRunner [
128 "-DFORCE_ENABLED=TRUE"
129 "-DENABLE_DAVIX=TRUE"
130 "-DENABLE_FUSE=${if (!stdenv.isDarwin) then "TRUE" else "FALSE"}" # not supported
131 "-DENABLE_MACAROONS=OFF"
132 "-DENABLE_PYTHON=FALSE" # built separately
133 "-DENABLE_SCITOKENS=TRUE"
134 "-DENABLE_TESTS=TRUE"
135 "-DENABLE_VOMS=${if stdenv.isLinux then "TRUE" else "FALSE"}"
138 postFixup = lib.optionalString (externalEtc != null) ''
139 moveToOutput etc "$etc"
140 ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
143 dontPatchELF = true; # shrinking rpath will cause runtime failures in dlopen
146 description = "High performance, scalable fault tolerant data access";
147 homepage = "https://xrootd.slac.stanford.edu";
148 license = licenses.lgpl3Plus;
149 platforms = platforms.all;
150 maintainers = with maintainers; [ ShamrockLee ];