about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorShamrock Lee <44064051+ShamrockLee@users.noreply.github.com>2022-04-23 03:53:34 +0800
committerShamrock Lee <44064051+ShamrockLee@users.noreply.github.com>2022-11-10 09:23:52 +0800
commit7f91dec5ddf8a75c8da23df982ad027ba333a150 (patch)
treea584ce907d5fd2dd7a6771e226558dcf929c3624 /pkgs/applications/science
parentda31bd56732b2b954c867b0283df66539b3764c0 (diff)
root: wrap the executable and patch thisroot.*
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/misc/root/default.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix
index f60fc95e0d56b..0435ca2e58507 100644
--- a/pkgs/applications/science/misc/root/default.nix
+++ b/pkgs/applications/science/misc/root/default.nix
@@ -4,11 +4,14 @@
 , fetchpatch
 , makeWrapper
 , cmake
+, coreutils
 , git
 , davix
 , ftgl
 , gl2ps
 , glew
+, gnugrep
+, gnused
 , gsl
 , lapack
 , libX11
@@ -20,14 +23,18 @@
 , libxcrypt
 , libxml2
 , llvm_9
+, lsof
 , lz4
 , xz
+, man
 , openblas
 , openssl
 , pcre
 , nlohmann_json
 , pkg-config
+, procps
 , python
+, which
 , xxHash
 , zlib
 , zstd
@@ -36,6 +43,9 @@
 , libjpeg
 , libtiff
 , libpng
+, patchRcPathCsh
+, patchRcPathFish
+, patchRcPathPosix
 , tbb
 , Cocoa
 , CoreSymbolication
@@ -93,6 +103,9 @@ stdenv.mkDerivation rec {
     libtiff
     libpng
     nlohmann_json
+    patchRcPathCsh
+    patchRcPathFish
+    patchRcPathPosix
     python.pkgs.numpy
     tbb
   ]
@@ -195,6 +208,45 @@ stdenv.mkDerivation rec {
         --set PYTHONPATH "$out/lib" \
         --set ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH "$out/lib"
     done
+
+    # Make ldd and sed available to the ROOT executable
+    wrapProgram "$out/bin/root" --prefix PATH : "${lib.makeBinPath [
+      gnused # sed
+      stdenv.cc # c++ ld etc.
+      stdenv.cc.libc # ldd
+    ]}"
+
+    # Patch thisroot.{sh,csh,fish}
+
+    # The main target of `thisroot.sh` is "bash-like shells",
+    # but it also need to support Bash-less POSIX shell like dash,
+    # as they are mentioned in `thisroot.sh`.
+
+    # `thisroot.sh` would include commands `lsof` and `procps` since ROOT 6.28.
+    # See https://github.com/root-project/root/pull/10332
+
+    patchRcPathPosix "$out/bin/thisroot.sh" "${lib.makeBinPath [
+      coreutils # dirname tail
+      gnugrep # grep
+      gnused # sed
+      lsof # lsof # for ROOT (>=6.28)
+      man # manpath
+      procps # ps # for ROOT (>=6.28)
+      which # which
+    ]}"
+    patchRcPathCsh "$out/bin/thisroot.csh" "${lib.makeBinPath [
+      coreutils
+      gnugrep
+      gnused
+      lsof # lsof # for ROOT (>=6.28)
+      man
+      which
+    ]}"
+    patchRcPathFish "$out/bin/thisroot.fish" "${lib.makeBinPath [
+      coreutils
+      man
+      which
+    ]}"
   '';
 
   setupHook = ./setup-hook.sh;