about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/biology/plink-ng/default.nix34
-rw-r--r--pkgs/applications/science/misc/root/default.nix3
-rw-r--r--pkgs/applications/science/misc/root/setup-hook.sh2
-rw-r--r--pkgs/applications/science/misc/root/thisroot.patch15
4 files changed, 53 insertions, 1 deletions
diff --git a/pkgs/applications/science/biology/plink-ng/default.nix b/pkgs/applications/science/biology/plink-ng/default.nix
new file mode 100644
index 000000000000..eb4d2714a127
--- /dev/null
+++ b/pkgs/applications/science/biology/plink-ng/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, zlib, openblas, darwin}:
+
+stdenv.mkDerivation rec {
+  name = "plink-ng-${version}";
+  version = "1.90b3";
+
+  src = fetchFromGitHub {
+    owner = "chrchang";
+    repo = "plink-ng";
+    rev = "v${version}";
+    sha256 = "1zhffjbwpd50dxywccbnv1rxy9njwz73l4awc5j7i28rgj3davcq";
+  };
+
+  buildInputs = [ zlib ] ++ (if stdenv.isDarwin then [ darwin.apple_sdk.frameworks.Accelerate ] else [ openblas ]) ;
+
+  buildPhase = ''
+    sed -i 's|zlib-1.2.8/zlib.h|zlib.h|g' *.c *.h
+    ${if stdenv.cc.isClang then "sed -i 's|g++|clang++|g' Makefile.std" else ""}
+    make ZLIB=-lz ${if stdenv.isDarwin then "" else "BLASFLAGS=-lopenblas"} -f Makefile.std
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp plink $out/bin
+  '';
+
+  meta = {
+    description = "A comprehensive update to the PLINK association analysis toolset";
+    homepage = "https://www.cog-genomics.org/plink2";
+    license = stdenv.lib.licenses.gpl3;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
+
diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix
index 45d7686b3e52..d1106a758473 100644
--- a/pkgs/applications/science/misc/root/default.nix
+++ b/pkgs/applications/science/misc/root/default.nix
@@ -21,6 +21,9 @@ stdenv.mkDerivation rec {
       sha256 = "186i7ni75yvjydy6lpmaplqxfb5z2019bgpbhff1n6zn2qlrff2r";
     })
     ./sw_vers.patch
+
+    # this prevents thisroot.sh from setting $p, which interferes with stdenv setup
+    ./thisroot.patch
   ];
 
   preConfigure = ''
diff --git a/pkgs/applications/science/misc/root/setup-hook.sh b/pkgs/applications/science/misc/root/setup-hook.sh
index 197dc78c3c2c..fc2b697d8a82 100644
--- a/pkgs/applications/science/misc/root/setup-hook.sh
+++ b/pkgs/applications/science/misc/root/setup-hook.sh
@@ -6,4 +6,4 @@ thisroot () {
     source @out@/bin/thisroot.sh
 }
 
-envHooks+=(thisroot)
+postHooks+=(thisroot)
diff --git a/pkgs/applications/science/misc/root/thisroot.patch b/pkgs/applications/science/misc/root/thisroot.patch
new file mode 100644
index 000000000000..57cd5838e64a
--- /dev/null
+++ b/pkgs/applications/science/misc/root/thisroot.patch
@@ -0,0 +1,15 @@
+diff --git a/config/thisroot.sh b/config/thisroot.sh
+index 85dee20..532cb28 100644
+--- a/config/thisroot.sh
++++ b/config/thisroot.sh
+@@ -15,8 +15,8 @@ drop_from_path()
+       return 1
+    fi
+ 
+-   p=$1
+-   drop=$2
++   local p=$1
++   local drop=$2
+ 
+    newpath=`echo $p | sed -e "s;:${drop}:;:;g" \
+                           -e "s;:${drop};;g"   \