about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/misc
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/misc')
-rw-r--r--nixpkgs/pkgs/applications/science/misc/boinc/default.nix46
-rw-r--r--nixpkgs/pkgs/applications/science/misc/colmap/default.nix44
-rw-r--r--nixpkgs/pkgs/applications/science/misc/cytoscape/default.nix43
-rw-r--r--nixpkgs/pkgs/applications/science/misc/cytoscape/gen_vmoptions_to_homedir.patch19
-rw-r--r--nixpkgs/pkgs/applications/science/misc/fityk/default.nix28
-rw-r--r--nixpkgs/pkgs/applications/science/misc/foldingathome/client.nix59
-rw-r--r--nixpkgs/pkgs/applications/science/misc/foldingathome/control.nix60
-rw-r--r--nixpkgs/pkgs/applications/science/misc/foldingathome/viewer.nix55
-rw-r--r--nixpkgs/pkgs/applications/science/misc/gephi/default.nix65
-rw-r--r--nixpkgs/pkgs/applications/science/misc/golly/beta.nix51
-rw-r--r--nixpkgs/pkgs/applications/science/misc/golly/default.nix39
-rw-r--r--nixpkgs/pkgs/applications/science/misc/golly/default.upstream5
-rw-r--r--nixpkgs/pkgs/applications/science/misc/gplates/default.nix30
-rw-r--r--nixpkgs/pkgs/applications/science/misc/megam/default.nix47
-rw-r--r--nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch12
-rw-r--r--nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch21
-rw-r--r--nixpkgs/pkgs/applications/science/misc/netlogo/default.nix58
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmodelica/default.nix55
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmodelica/fakegit.nix81
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-git.nix71
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-svn.nix5
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmodelica/src-main.nix6
-rwxr-xr-xnixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-git.sh64
-rwxr-xr-xnixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-svn.sh50
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmvg/default.nix49
-rw-r--r--nixpkgs/pkgs/applications/science/misc/openmvs/default.nix64
-rw-r--r--nixpkgs/pkgs/applications/science/misc/rink/default.nix28
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/5.nix91
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/default.nix92
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/disable_libc_dicts_root5.patch27
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/purify_include_paths_root5.patch204
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/setup-hook.sh13
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/sw_vers.patch101
-rw-r--r--nixpkgs/pkgs/applications/science/misc/root/sw_vers_root5.patch104
-rw-r--r--nixpkgs/pkgs/applications/science/misc/sasview/default.nix75
-rw-r--r--nixpkgs/pkgs/applications/science/misc/sasview/local_config.patch22
-rw-r--r--nixpkgs/pkgs/applications/science/misc/sasview/pyparsing-fix.patch13
-rw-r--r--nixpkgs/pkgs/applications/science/misc/sasview/xhtml2pdf.nix33
-rw-r--r--nixpkgs/pkgs/applications/science/misc/simgrid/default.nix112
-rw-r--r--nixpkgs/pkgs/applications/science/misc/snakemake/default.nix43
-rw-r--r--nixpkgs/pkgs/applications/science/misc/tulip/default.nix39
-rw-r--r--nixpkgs/pkgs/applications/science/misc/vite/default.nix44
42 files changed, 2168 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/misc/boinc/default.nix b/nixpkgs/pkgs/applications/science/misc/boinc/default.nix
new file mode 100644
index 000000000000..802abae80e1d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/boinc/default.nix
@@ -0,0 +1,46 @@
+{ fetchFromGitHub, stdenv, autoconf, automake, pkgconfig, m4, curl,
+libGLU, libGL, libXmu, libXi, freeglut, libjpeg, libtool, wxGTK30, xcbutil,
+sqlite, gtk2, patchelf, libXScrnSaver, libnotify, libX11, libxcb }:
+
+let
+  majorVersion = "7.14";
+  minorVersion = "2";
+in
+
+stdenv.mkDerivation rec {
+  version = "${majorVersion}.${minorVersion}";
+  pname = "boinc";
+
+  src = fetchFromGitHub {
+    name = "${pname}-${version}-src";
+    owner = "BOINC";
+    repo = "boinc";
+    rev = "client_release/${majorVersion}/${version}";
+    sha256 = "0nicpkag18xq0libfqqvs0im22mijpsxzfk272iwdd9l0lmgfvyd";
+  };
+
+  nativeBuildInputs = [ libtool automake autoconf m4 pkgconfig ];
+
+  buildInputs = [
+    curl libGLU libGL libXmu libXi freeglut libjpeg wxGTK30 sqlite gtk2 libXScrnSaver
+    libnotify patchelf libX11 libxcb xcbutil
+  ];
+
+  NIX_LDFLAGS = "-lX11";
+
+  preConfigure = ''
+    ./_autosetup
+    configureFlags="$configureFlags --sysconfdir=$out/etc"
+  '';
+
+  enableParallelBuilding = true;
+
+  configureFlags = [ "--disable-server" ];
+
+  meta = {
+    description = "Free software for distributed and grid computing";
+    homepage = "https://boinc.berkeley.edu/";
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/colmap/default.nix b/nixpkgs/pkgs/applications/science/misc/colmap/default.nix
new file mode 100644
index 000000000000..83dff3e08f15
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/colmap/default.nix
@@ -0,0 +1,44 @@
+{ mkDerivation, lib, fetchpatch, fetchFromGitHub, cmake, boost17x, ceres-solver, eigen,
+  freeimage, glog, libGLU, glew, qtbase,
+  cudaSupport ? false, cudatoolkit ? null }:
+
+assert !cudaSupport || cudatoolkit != null;
+
+let boost_static = boost17x.override { enableStatic = true; };
+in
+mkDerivation rec {
+  version = "3.5";
+  pname = "colmap";
+  src = fetchFromGitHub {
+     owner = "colmap";
+     repo = "colmap";
+     rev = version;
+     sha256 = "1vnb62p0y2bnga173wmjs0lnyqdjikv0fkcxjzxm8187khk2lly8";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/colmap/colmap/commit/6af3d8b0048cecc3b9fc6f4e78c3214dd038180b.patch";
+      sha256 = "1zv5girmv4hv78w1xn131v8njwhpbyylc1m15731lnhrs8bri0jq";
+    })
+  ];
+
+  buildInputs = [
+    boost_static ceres-solver eigen
+    freeimage glog libGLU glew qtbase
+  ] ++ lib.optional cudaSupport cudatoolkit;
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "COLMAP - Structure-From-Motion and Multi-View Stereo pipeline";
+    longDescription = ''
+       COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline
+       with a graphical and command-line interface.
+    '';
+    homepage = "https://colmap.github.io/index.html";
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ lebastr ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/cytoscape/default.nix b/nixpkgs/pkgs/applications/science/misc/cytoscape/default.nix
new file mode 100644
index 000000000000..12cdeb453d7a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/cytoscape/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, jre, makeWrapper, substituteAll, coreutils }:
+
+stdenv.mkDerivation rec {
+  pname = "cytoscape";
+  version = "3.8.1";
+
+  src = fetchurl {
+    url = "https://github.com/cytoscape/cytoscape/releases/download/${version}/${pname}-unix-${version}.tar.gz";
+    sha256 = "006g0w29sccg5h0zlrxdp3lx4vx1bfdhx2cms6aah85r5b82wgkf";
+  };
+
+  patches = [
+    # By default, gen_vmoptions.sh tries to store custom options in $out/share
+    # at run time. This patch makes sure $HOME is used instead.
+    (substituteAll {
+      src = ./gen_vmoptions_to_homedir.patch;
+      inherit coreutils;
+    })
+  ];
+
+  buildInputs = [jre makeWrapper];
+
+  installPhase = ''
+    mkdir -pv $out/{share,bin}
+    cp -Rv * $out/share/
+
+    ln -s $out/share/cytoscape.sh $out/bin/cytoscape
+
+    wrapProgram $out/share/cytoscape.sh \
+      --set JAVA_HOME "${jre}" \
+      --set JAVA  "${jre}/bin/java"
+
+    chmod +x $out/bin/cytoscape
+  '';
+
+  meta = {
+    homepage = "http://www.cytoscape.org";
+    description = "A general platform for complex network analysis and visualization";
+    license = stdenv.lib.licenses.lgpl21;
+    maintainers = [stdenv.lib.maintainers.mimame];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/cytoscape/gen_vmoptions_to_homedir.patch b/nixpkgs/pkgs/applications/science/misc/cytoscape/gen_vmoptions_to_homedir.patch
new file mode 100644
index 000000000000..e31681e8541f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/cytoscape/gen_vmoptions_to_homedir.patch
@@ -0,0 +1,19 @@
+diff -Nur a/gen_vmoptions.sh b/gen_vmoptions.sh
+--- a/gen_vmoptions.sh	2020-03-30 21:57:47.000000000 +0100
++++ b/gen_vmoptions.sh	2020-05-05 09:49:57.974989824 +0100
+@@ -1,13 +1,10 @@
+ #!/bin/sh
+ # Generates the Cytoscape.vmoptions file
+ 
+-script_path="$(dirname -- $0)"
+-
+-#vm_options_path="$HOME/.cytoscape"
+-vm_options_path=$script_path
++vm_options_path="$HOME/.cytoscape"
+ 
+ if [ ! -e $vm_options_path ]; then
+-    /bin/mkdir $vm_options_path
++    @coreutils@/bin/mkdir $vm_options_path
+ fi
+ 
+ # Determine amount of physical memory present:
diff --git a/nixpkgs/pkgs/applications/science/misc/fityk/default.nix b/nixpkgs/pkgs/applications/science/misc/fityk/default.nix
new file mode 100644
index 000000000000..18def1d24e2f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/fityk/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, wxGTK30, boost, lua, zlib, bzip2
+, xylib, readline, gnuplot, swig3 }:
+
+let
+  name    = "fityk";
+  version = "1.3.1";
+in
+stdenv.mkDerivation {
+  name = "${name}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "wojdyr";
+    repo = "fityk";
+    rev = "v${version}";
+    sha256 = "0kmrjjjwrh6xgw590awcd52b86kksmv6rfgih75zvpiavr1ygwsi";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ wxGTK30 boost lua zlib bzip2 xylib readline
+    gnuplot swig3 ];
+
+  meta = {
+    description = "Curve fitting and peak fitting software";
+    license = stdenv.lib.licenses.gpl2;
+    homepage = "http://fityk.nieto.pl/";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/foldingathome/client.nix b/nixpkgs/pkgs/applications/science/misc/foldingathome/client.nix
new file mode 100644
index 000000000000..74a53902ee09
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/foldingathome/client.nix
@@ -0,0 +1,59 @@
+{ stdenv
+, autoPatchelfHook
+, buildFHSUserEnv
+, dpkg
+, fetchurl
+, gcc-unwrapped
+, ocl-icd
+, zlib
+, extraPkgs ? []
+}:
+let
+  majMin = stdenv.lib.versions.majorMinor version;
+  version = "7.6.9";
+
+  fahclient = stdenv.mkDerivation rec {
+    inherit version;
+    pname = "fahclient";
+
+    src = fetchurl {
+      url = "https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v${majMin}/fahclient_${version}_amd64.deb";
+      sha256 = "1v4yijjjdq9qx1fp60flp9ya6ywl9qdsgkzwmzjzp8sd5gfvhyr6";
+    };
+
+    nativeBuildInputs = [
+      autoPatchelfHook
+      dpkg
+    ];
+
+    buildInputs = [
+      gcc-unwrapped.lib
+      zlib
+    ];
+
+    unpackPhase = "dpkg-deb -x ${src} ./";
+    installPhase = "cp -ar usr $out";
+  };
+in
+buildFHSUserEnv {
+  name = fahclient.name;
+
+  targetPkgs = pkgs': [
+    fahclient
+    ocl-icd
+  ] ++ extraPkgs;
+
+  runScript = "/bin/FAHClient";
+
+  extraInstallCommands = ''
+    mv $out/bin/$name $out/bin/FAHClient
+  '';
+
+  meta = {
+    description = "Folding@home client";
+    homepage = "https://foldingathome.org/";
+    license = stdenv.lib.licenses.unfree;
+    maintainers = [ stdenv.lib.maintainers.zimbatm ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/foldingathome/control.nix b/nixpkgs/pkgs/applications/science/misc/foldingathome/control.nix
new file mode 100644
index 000000000000..91c3b8c779cd
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/foldingathome/control.nix
@@ -0,0 +1,60 @@
+{ stdenv
+, autoPatchelfHook
+, dpkg
+, fahviewer
+, fetchurl
+, makeWrapper
+, python2
+}:
+let
+  majMin = stdenv.lib.versions.majorMinor version;
+  version = "7.6.13";
+
+  python = python2.withPackages
+    (
+      ps: [
+        ps.pycairo
+        ps.pygobject2
+        ps.pygtk
+      ]
+    );
+in
+stdenv.mkDerivation rec {
+  inherit version;
+  pname = "fahcontrol";
+
+  src = fetchurl {
+    url = "https://download.foldingathome.org/releases/public/release/fahcontrol/debian-stable-64bit/v${majMin}/fahcontrol_${version}-1_all.deb";
+    sha256 = "0qfvhwc29cgqkwf2bkhq4gr2d1c4jgccfs58916ss03n4rwz9gng";
+  };
+
+  nativeBuildInputs = [
+    dpkg
+    makeWrapper
+  ];
+
+  buildInputs = [ fahviewer python ];
+
+  doBuild = false;
+
+  unpackPhase = ''
+    dpkg-deb -x ${src} ./
+  '';
+
+  installPhase = "cp -ar usr $out";
+
+  postFixup = ''
+    sed -e 's|/usr/bin|$out/bin|g' -i $out/share/applications/FAHControl.desktop
+    wrapProgram "$out/bin/FAHControl" \
+      --suffix PATH : "${fahviewer.outPath}/bin" \
+      --set PYTHONPATH "$out/lib/python2.7/dist-packages"
+  '';
+
+  meta = {
+    description = "Folding@home control";
+    homepage = "https://foldingathome.org/";
+    license = stdenv.lib.licenses.unfree;
+    maintainers = [ stdenv.lib.maintainers.zimbatm ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/foldingathome/viewer.nix b/nixpkgs/pkgs/applications/science/misc/foldingathome/viewer.nix
new file mode 100644
index 000000000000..cdeed6536efa
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/foldingathome/viewer.nix
@@ -0,0 +1,55 @@
+{ stdenv
+, autoPatchelfHook
+, dpkg
+, fetchurl
+, freeglut
+, gcc-unwrapped
+, libGL
+, libGLU
+, makeWrapper
+, zlib
+}:
+let
+  majMin = stdenv.lib.versions.majorMinor version;
+  version = "7.6.13";
+in
+stdenv.mkDerivation rec {
+  inherit version;
+  pname = "fahviewer";
+
+  src = fetchurl {
+    url = "https://download.foldingathome.org/releases/public/release/fahviewer/debian-stable-64bit/v${majMin}/fahviewer_${version}_amd64.deb";
+    sha256 = "09yfvk16j1iwx8h1xg678ks3bc8760gfdn7n32j8r893kd32cwyk";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    dpkg
+    makeWrapper
+  ];
+
+  buildInputs = [
+    freeglut
+    gcc-unwrapped.lib
+    libGL
+    libGLU
+    zlib
+  ];
+
+  unpackPhase = ''
+    dpkg-deb -x ${src} ./
+    sed -e 's|/usr/bin|$out/bin|g' -i usr/share/applications/FAHViewer.desktop
+  '';
+
+  installPhase = ''
+    cp -ar usr $out
+  '';
+
+  meta = {
+    description = "Folding@home viewer";
+    homepage = "https://foldingathome.org/";
+    license = stdenv.lib.licenses.unfree;
+    maintainers = [ stdenv.lib.maintainers.zimbatm ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/gephi/default.nix b/nixpkgs/pkgs/applications/science/misc/gephi/default.nix
new file mode 100644
index 000000000000..b6b53013cb4b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/gephi/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchFromGitHub, jdk, maven, javaPackages }:
+
+let
+  version = "0.9.2";
+
+  src = fetchFromGitHub {
+    owner = "gephi";
+    repo = "gephi";
+    rev = "v${version}";
+    sha256 = "0kqp2nvnsb55j1axb6hk0mlw5alyaiyb70z0mdybhpqqxyw2da2r";
+  };
+
+  # perform fake build to make a fixed-output derivation out of the files downloaded from maven central (120MB)
+  deps = stdenv.mkDerivation {
+    name = "gephi-${version}-deps";
+    inherit src;
+    buildInputs = [ jdk maven ];
+    buildPhase = ''
+      while mvn package -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do
+        echo "timeout, restart maven to continue downloading"
+      done
+    '';
+    # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
+    installPhase = ''find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete'';
+    outputHashAlgo = "sha256";
+    outputHashMode = "recursive";
+    outputHash = "1p7yf97dn0nvr005cbs6vdk3i341s8fya4kfccj8qqad2qgxflif";
+  };
+in
+stdenv.mkDerivation {
+  pname = "gephi";
+  inherit version;
+
+  inherit src;
+
+  buildInputs = [ jdk maven ];
+
+  buildPhase = ''
+    # 'maven.repo.local' must be writable so copy it out of nix store
+    mvn package --offline -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
+  '';
+
+  installPhase = ''
+    cp -r modules/application/target/gephi $out
+
+    # remove garbage
+    find $out -type f -name  .lastModified -delete
+    find $out -type f -regex '.+\.exe'     -delete
+
+    # use self-compiled JOGL to avoid patchelf'ing .so inside jars
+    rm $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-{jogl,gluegen}/*.jar
+    cp ${javaPackages.jogl_2_3_2}/share/java/jogl*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-jogl/
+    cp ${javaPackages.jogl_2_3_2}/share/java/glue*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-gluegen/
+
+    echo "jdkhome=${jdk}" >> $out/etc/gephi.conf
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A platform for visualizing and manipulating large graphs";
+    homepage = "https://gephi.org";
+    license = licenses.gpl3;
+    maintainers = [ maintainers.taeer ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/golly/beta.nix b/nixpkgs/pkgs/applications/science/misc/golly/beta.nix
new file mode 100644
index 000000000000..36de6a1d4c50
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/golly/beta.nix
@@ -0,0 +1,51 @@
+{stdenv, fetchgit
+, wxGTK, perl, python2, zlib, libGLU, libGL, libX11
+, automake, autoconf
+}:
+
+stdenv.mkDerivation rec {
+  pname = "golly";
+  version = "2.8.99.2.20161122";
+  #src = fetchurl {
+  #  url="mirror://sourceforge/project/golly/golly/golly-2.8/golly-2.8-src.tar.gz";
+  #  sha256="0a4vn2hm7h4b47v2iwip1z3n9y8isf79v08aipl2iqms2m3p5204";
+  #};
+  src = fetchgit {
+    url = "git://git.code.sf.net/p/golly/code";
+    rev = "93495edf3c9639332c6eb43ca7149c69629ee5d8";
+    sha256 = "1j308s9zlqkr3wnl1l32s5zk7r3g4ijwawkkysl8j5ik9sibi2gk";
+  };
+
+  setSourceRoot = ''
+    export sourceRoot="$(echo */gui-wx/configure)"
+  '';
+
+  nativeBuildInputs = [autoconf automake];
+
+  buildInputs = [
+    wxGTK perl python2 zlib libGLU libGL libX11
+  ];
+
+  # Link against Python explicitly as it is needed for scripts
+  makeFlags=[
+    "AM_LDFLAGS="
+  ];
+  NIX_LDFLAGS="-l${python2.libPrefix} -lperl -ldl -lGL";
+  preConfigure=''
+    export NIX_LDFLAGS="$NIX_LDFLAGS -L$(dirname "$(find ${perl} -name libperl.so)")"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE
+      -DPYTHON_SHLIB=$(basename "$(
+        readlink -f ${python2}/lib/libpython*.so)")"
+
+    sh autogen.sh
+  '';
+
+  meta = {
+    inherit version;
+    description = "Cellular automata simulation program";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+    downloadPage = "https://sourceforge.net/projects/golly/files/golly";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/golly/default.nix b/nixpkgs/pkgs/applications/science/misc/golly/default.nix
new file mode 100644
index 000000000000..1478bb643181
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/golly/default.nix
@@ -0,0 +1,39 @@
+{stdenv, fetchurl, wxGTK, perl, python2, zlib, libGLU, libGL, libX11}:
+stdenv.mkDerivation rec {
+  pname = "golly";
+  version = "3.3";
+
+  src = fetchurl {
+    sha256 = "1j3ksnar4rdam4xiyspgyrs1pifbvxfxkrn65brkwxpx39mpgzc8";
+    url="mirror://sourceforge/project/golly/golly/golly-${version}/golly-${version}-src.tar.gz";
+  };
+
+  buildInputs = [
+    wxGTK perl python2 zlib libGLU libGL libX11
+  ];
+
+  setSourceRoot = ''
+    sourceRoot=$(echo */gui-wx/configure)
+  '';
+
+  # Link against Python explicitly as it is needed for scripts
+  makeFlags=[
+    "AM_LDFLAGS="
+  ];
+  NIX_LDFLAGS="-l${python2.libPrefix} -lperl";
+  preConfigure=''
+    export NIX_LDFLAGS="$NIX_LDFLAGS -L$(dirname "$(find ${perl} -name libperl.so)")"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE
+      -DPYTHON_SHLIB=$(basename "$(
+        readlink -f ${python2}/lib/libpython*.so)")"
+  '';
+
+  meta = {
+    inherit version;
+    description = "Cellular automata simulation program";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+    downloadPage = "https://sourceforge.net/projects/golly/files/golly";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/golly/default.upstream b/nixpkgs/pkgs/applications/science/misc/golly/default.upstream
new file mode 100644
index 000000000000..e8ce81586a8d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/golly/default.upstream
@@ -0,0 +1,5 @@
+url https://sourceforge.net/projects/golly/files/golly/
+version_link '[-][0-9.]+/$'
+SF_version_tarball 'src'
+SF_redirect
+minimize_overwrite
diff --git a/nixpkgs/pkgs/applications/science/misc/gplates/default.nix b/nixpkgs/pkgs/applications/science/misc/gplates/default.nix
new file mode 100644
index 000000000000..4bef967bc08a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/gplates/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, qt4, qwt6_qt4, libGLU, libGL, glew, gdal, cgal
+, proj, boost, cmake, python2, doxygen, graphviz, gmp, mpfr }:
+
+stdenv.mkDerivation rec {
+  pname = "gplates";
+  version = "2.2.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gplates/${pname}-${version}-unixsrc.tar.bz2";
+    sha256 = "1jrcv498vpcs8xklhbsgg12yfa90f96p2mwq6x5sjnrlpf8mh50b";
+  };
+
+  buildInputs = [
+    qt4 qwt6_qt4 libGLU libGL glew gdal cgal proj cmake python2
+    doxygen graphviz gmp mpfr
+    (boost.override {
+      enablePython = true;
+      python = python2;
+    })
+  ];
+
+  NIX_CFLAGS_LINK="-ldl -lpthread -lutil";
+
+  meta = with stdenv.lib; {
+    description = "Desktop software for the interactive visualisation of plate-tectonics";
+    homepage = "https://www.gplates.org";
+    license = licenses.gpl2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/megam/default.nix b/nixpkgs/pkgs/applications/science/misc/megam/default.nix
new file mode 100644
index 000000000000..8bb64932f20e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/megam/default.nix
@@ -0,0 +1,47 @@
+{ fetchurl, stdenv, ocaml, makeWrapper, ncurses }:
+
+let version = "0.92"; in
+stdenv.mkDerivation {
+  pname = "megam";
+  inherit version;
+
+  src = fetchurl {
+    url = "http://hal3.name/megam/megam_src.tgz";
+    sha256 = "dc0e9f59ff8513449fe3bd40b260141f89c88a4edf6ddc8b8a394c758e49724e";
+  };
+
+  patches = [ ./ocaml-includes.patch ./ocaml-3.12.patch ];
+  
+  buildInputs = [ ocaml ncurses ];
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  makeFlags = [ "CAML_INCLUDES=${ocaml}/lib/ocaml/caml" ];
+
+  # see https://bugzilla.redhat.com/show_bug.cgi?id=435559
+  dontStrip = true;
+
+  installPhase = ''
+    mkdir -pv $out/bin
+    cp -Rv megam $out/bin
+  '';
+
+
+  meta = {
+    description = "MEGA Model Optimization Package";
+
+    longDescription =
+      ''  The software here is an implementation of maximum likelihood
+          and maximum a posterior optimization of the parameters of
+          these models.  The algorithms used are much more efficient
+          than the iterative scaling techniques used in almost every
+          other maxent package out there.  '';
+
+    homepage = "http://www.umiacs.umd.edu/~hal/megam";
+
+    license = "non-commercial";
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch
new file mode 100644
index 000000000000..8265acf6e4a7
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch
@@ -0,0 +1,12 @@
+diff -ru megam_0.92/Makefile megam_0.92-b/Makefile
+--- megam_0.92/Makefile	2007-10-08 18:06:04.000000000 +0100
++++ megam_0.92-b/Makefile	2013-11-25 10:14:20.000000000 +0000
+@@ -59,7 +59,7 @@
+ 
+ WITHUNIX =unix.cma -cclib -lunix
+ 
+-WITHSTR =str.cma -cclib -lstr
++WITHSTR =str.cma -cclib -lcamlstr
+ 
+ WITHBIGARRAY =bigarray.cma -cclib -lbigarray
+ 
diff --git a/nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch
new file mode 100644
index 000000000000..b3a56643448c
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch
@@ -0,0 +1,21 @@
+diff -ru megam_0.92/Makefile megam_0.92-b/Makefile
+--- megam_0.92/Makefile	2007-10-08 18:06:04.000000000 +0100
++++ megam_0.92-b/Makefile	2013-11-25 10:14:20.000000000 +0000
+@@ -41,7 +41,7 @@
+ #
+ # The Caml compilers. #
+ # You may fix here the path to access the Caml compiler on your machine
+-CAMLC = ocamlc -g
++CAMLC = ocamlc -g $(WITHCLIBS)
+ CAMLOPT = ocamlopt -unsafe -ccopt -O4 -ccopt -ffast-math -inline 99999 
+ CAMLDEP = ocamldep
+ CAMLLEX = ocamllex
+@@ -70,7 +70,7 @@
+ WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
+ 
+ #WITHCLIBS =-I /usr/lib/ocaml/3.09.2/caml
+-WITHCLIBS =-I /usr/lib/ocaml/caml
++WITHCLIBS =-I $(CAML_INCLUDES) 
+ 
+ ################ End of user's variables #####################
+ 
diff --git a/nixpkgs/pkgs/applications/science/misc/netlogo/default.nix b/nixpkgs/pkgs/applications/science/misc/netlogo/default.nix
new file mode 100644
index 000000000000..af892441a472
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/netlogo/default.nix
@@ -0,0 +1,58 @@
+{ jre, stdenv, fetchurl, makeWrapper, makeDesktopItem }:
+
+let
+
+  desktopItem = makeDesktopItem rec {
+    name = "netlogo";
+    exec = name;
+    icon = name;
+    comment = "A multi-agent programmable modeling environment";
+    desktopName = "NetLogo";
+    categories = "Science;";
+  };
+
+in
+
+stdenv.mkDerivation rec {
+  pname = "netlogo";
+  version = "6.1.1";
+
+  src = fetchurl {
+    url = "https://ccl.northwestern.edu/netlogo/${version}/NetLogo-${version}-64.tgz";
+    sha256 = "1j08df68pgggxqkmpzd369w4h97q0pivmmljdb48hjghx7hacblp";
+  };
+
+  src1 = fetchurl {
+    name = "netlogo.png";
+    url = "https://netlogoweb.org/assets/images/desktopicon.png";
+    sha256 = "1i43lhr31lzva8d2r0dxpcgr58x496gb5vmb0h2da137ayvifar8";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -pv $out/share/netlogo $out/share/icons/hicolor/256x256/apps $out/share/applications $out/share/doc
+    cp -rv app $out/share/netlogo
+    cp -v readme.md $out/share/doc/
+
+    # launcher with `cd` is required b/c otherwise the model library isn't usable
+    makeWrapper "${jre}/bin/java" "$out/bin/netlogo" \
+      --run "cd $out/share/netlogo/app" \
+      --add-flags "-jar netlogo-${version}.jar"
+
+    cp $src1 $out/share/icons/hicolor/256x256/apps/netlogo.png
+    cp ${desktopItem}/share/applications/* $out/share/applications
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A multi-agent programmable modeling environment";
+    longDescription = ''
+      NetLogo is a multi-agent programmable modeling environment. It is used by
+      many tens of thousands of students, teachers and researchers worldwide.
+    '';
+    homepage = "https://ccl.northwestern.edu/netlogo/index.shtml";
+    license = licenses.gpl2;
+    maintainers = [ maintainers.dpaetzel ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/default.nix b/nixpkgs/pkgs/applications/science/misc/openmodelica/default.nix
new file mode 100644
index 000000000000..50d4dcc1a9ff
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/default.nix
@@ -0,0 +1,55 @@
+{stdenv, fetchgit, fetchsvn, autoconf, automake, libtool, gfortran, clang, cmake, gnumake,
+hwloc, jre, lapack, blas, hdf5, expat, ncurses, readline, qt4, webkitgtk, which,
+lp_solve, omniorb, sqlite, libatomic_ops, pkgconfig, file, gettext, flex, bison,
+doxygen, boost, openscenegraph, gnome2, xorg, git, bash, gtk2, makeWrapper }:
+
+let
+
+  fakegit = import ./fakegit.nix {inherit stdenv fetchgit fetchsvn bash;} ;
+
+in
+
+stdenv.mkDerivation {
+  name = "openmodelica";
+
+  src = fetchgit (import ./src-main.nix);
+
+  buildInputs = [autoconf cmake automake libtool gfortran clang gnumake
+    hwloc jre lapack blas hdf5 expat ncurses readline qt4 webkitgtk which
+    lp_solve omniorb sqlite libatomic_ops pkgconfig file gettext flex bison
+    doxygen boost openscenegraph gnome2.gtkglext xorg.libXmu
+    git gtk2 makeWrapper];
+
+  hardeningDisable = [ "format" ];
+
+  enableParallelBuilding = true;
+
+  patchPhase = ''
+    cp -fv ${fakegit}/bin/checkout-git.sh libraries/checkout-git.sh
+    cp -fv ${fakegit}/bin/checkout-svn.sh libraries/checkout-svn.sh
+  '';
+
+  configurePhase = ''
+    export NIX_LDFLAGS="$NIX_LDFLAGS -L${gfortran.cc.lib}/lib"
+
+    autoconf
+    ./configure CC=${clang}/bin/clang CXX=${clang}/bin/clang++ --prefix=$out
+  '';
+
+  postFixup = ''
+    for e in $(cd $out/bin && ls); do
+      wrapProgram $out/bin/$e \
+        --prefix PATH : "${gnumake}/bin" \
+        --prefix LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ lapack blas ]}"
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "OpenModelica is an open-source Modelica-based modeling and simulation environment";
+    homepage    = "https://openmodelica.org";
+    license     = licenses.gpl3;
+    maintainers = with maintainers; [ smironov ];
+    platforms   = platforms.linux;
+    broken      = true;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/fakegit.nix b/nixpkgs/pkgs/applications/science/misc/openmodelica/fakegit.nix
new file mode 100644
index 000000000000..de69626cd3ee
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/fakegit.nix
@@ -0,0 +1,81 @@
+{stdenv, fetchgit, fetchsvn, bash } :
+
+let
+  mkscript = path : text : ''
+    mkdir -pv `dirname ${path}`
+    cat > ${path} <<"EOF"
+    #!${bash}/bin/bash
+    ME=`basename ${path}`
+    ${text}
+    EOF
+    sed -i "s@%out@$out@g" ${path}
+    chmod +x ${path}
+  '';
+  
+  hashname = r: let
+    rpl = stdenv.lib.replaceChars [":" "/"] ["_" "_"];
+  in
+    (rpl r.url) + "-" + (rpl r.rev);
+
+in
+
+stdenv.mkDerivation {
+  name = "fakegit";
+
+  buildCommand = ''
+    mkdir -pv $out/repos
+    ${stdenv.lib.concatMapStrings
+       (r : ''
+        cp -r ${fetchgit r} $out/repos/${hashname r}
+       ''
+       ) (import ./src-libs-git.nix)
+    }
+
+    ${mkscript "$out/bin/checkout-git.sh" ''
+      if test "$#" -ne 4; then
+        echo "Usage: $0 DESTINATION URL GITBRANCH HASH"
+        exit 1
+      fi
+      DEST=$1
+      URL=`echo $2 | tr :/ __`
+      GITBRANCH=$3
+      REVISION=$4
+
+      L=`echo $REVISION | wc -c`
+      if expr $L '<' 10 >/dev/null; then
+        REVISION=refs/tags/$REVISION
+      fi
+
+      REVISION=`echo $REVISION | tr :/ __`
+
+      rm -rf $DEST
+      mkdir -pv $DEST
+      echo "FAKEGIT cp -r %out/repos/$URL-$REVISION $DEST" >&2
+      cp -r %out/repos/$URL-$REVISION/* $DEST
+      chmod u+w -R $DEST
+    ''}
+
+    ${stdenv.lib.concatMapStrings
+       (r : ''
+        cp -r ${fetchsvn r} $out/repos/${hashname r}
+       ''
+       ) (import ./src-libs-svn.nix)
+    }
+
+    ${mkscript "$out/bin/checkout-svn.sh" ''
+      if test "$#" -ne 3; then
+        echo "Usage: $0 DESTINATION URL REVISION"
+        exit 1
+      fi
+      DEST=$1
+      URL=`echo $2 | tr :/ __`
+      REVISION=`echo $4 | tr :/ __`
+
+      rm -rf $DEST
+      mkdir -pv $DEST
+      echo "FAKE COPY %out/repos/$URL-$REVISION $DEST"
+      cp -r %out/repos/$URL-$REVISION/* $DEST
+      chmod u+w -R $DEST
+    ''}
+  '';
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-git.nix b/nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-git.nix
new file mode 100644
index 000000000000..aae5ab321fbe
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-git.nix
@@ -0,0 +1,71 @@
+[
+{ url = "https://github.com/modelica-3rdparty/ADGenKinetics.git"; rev = "42428db6e84bcde28543a3bba9bccee581309bb1"; sha256="14l005jwj1wz35gq8xlbzfz0bpsx99rs4q3dxkfh76yhnv1jh9h3"; }
+{ url = "https://github.com/modelica-3rdparty/ADMSL.git"; rev = "ed0305603f86b46d9af03e7d37dcb8b6704915b4"; sha256="15b0nqxyh8444az56ydjn594jikdl1ina5wamabk3nzm1yx218cl"; }
+{ url = "https://github.com/iea-annex60/modelica-annex60.git"; rev = "8015a01591bb24d219f57e7b69cdfcde66e39b47"; sha256="05k4pa007a6p628fq1xac0cfv8g8dnpy2bgy8h99rqpmlaa072z7"; }
+{ url = "https://github.com/OpenModelica/BioChem.git"; rev = "b5f3cb999f3cfad2bbb6fb429b496f61ecf2f628"; sha256="1l52dg888vwx4668spn59hqvfkpl9g06g8n2cdxiap7lvsyh6w9x"; }
+{ url = "https://github.com/modelica-3rdparty/BondGraph.git"; rev = "20c23e60d12989bd4668ccac47659d82d39d29cc"; sha256="1i9cmiy1ya04h2ld0gy0x2gvdrfksl66fmcrgdm1vpsnbb6pviv9"; }
+{ url = "https://github.com/modelica-3rdparty/BondLib.git"; rev = "df7a40fe612617da22e27d39edfa4b27d65f23d0"; sha256="005djwxd568zyk3ndss9hv165dci9x0dgjmcdjhnqmsap3w83hlz"; }
+{ url = "https://github.com/modelica-3rdparty/BrineProp.git"; rev = "fed013cdeec0fb9552964376b575a8e3635539ab"; sha256="020hm2q65d5iv3h8b3lhgl6j930vi2pbh4lvxv3b3k7i9z02q43a"; }
+{ url = "https://github.com/lbl-srg/modelica-buildings.git"; rev = "ef89361cc8673b077b9221efbf78aa63b4d7babd"; sha256="04gclknhl2f5z7w9fsbhwawisd0ibmvwpplx0siqwzvjx7nsmdg4"; }
+{ url = "https://github.com/lbl-srg/modelica-buildings.git"; rev = "444aa231f423b8d04225bf8672e3212d089fbfe4"; sha256="0q754mlkwqj0jcqsmxksvcz4ak2i86f9s41fhffh5jvra27cvq01"; }
+{ url = "https://github.com/modelica-3rdparty/Chemical.git"; rev = "aa2642608e587ddb6897e8c3ffabb3aa099510bd"; sha256="0y46spcb6rw0jpj4v20nlw8xlvi5kypij46f1msvwgr7dfgy4gl4"; }
+{ url = "https://github.com/modelica-3rdparty/ComplexLib.git"; rev = "0b78942ee4fa95ae71347a0d552dd869fdf4c708"; sha256="18llf5ccrq3b0f4cjznfycskwf78pik8370xv45w9gb51gamszrn"; }
+{ url = "https://github.com/lochel/ConPNlib.git"; rev = "bbf6e9711665d55e5a8cf2f7235fa013c2315104"; sha256="0g3ll44sn2ff14qxwdyakw9h5b8b7vzabxp8cb8km16wcdqzgcxx"; }
+{ url = "https://github.com/modelica-3rdparty/DESLib.git"; rev = "7a473d8d16b118c3ea05761c6f43b17fd9838e4e"; sha256="19f2121n8rdc9svcjk8irivsd9wqcb9ai9jx72s2r85fkbvm8jc3"; }
+{ url = "https://github.com/modelica-3rdparty/ExtendedPetriNets.git"; rev = "2f4eac0651c1ab0ed56b75ec61424e0ef15181d3"; sha256="0wwj756pg33qwb90ycbfkrk5xsiwsbrqvq3i16i4pisi21vl6jk9"; }
+{ url = "https://github.com/modelica-3rdparty/ExternData.git"; rev = "396164fa708cc7c7e64da55ac0b3cba23939f790"; sha256="09052qmv91a9wawsl93b5b3q47awrxhnsbb9mrv39kpnwygfh7dq"; }
+{ url = "https://github.com/modelica/ExternalMedia.git"; rev = "1b77869b31dc3509defeccb1236db4b05d2f6f5b"; sha256="05sszn4bn8r78syydyjq8csn9xv4az56mm9lrarqykqdh78pvlqp"; }
+{ url = "https://github.com/kdavies4/FCSys.git"; rev = "cb4b17f34313b9d8f2d4223d5365684b4dc1ab65"; sha256="114p7ja6b3fwlkvkkjhbx78fxc7v4af2sbs783hkdga86m1v4ib6"; }
+{ url = "https://github.com/modelica-3rdparty/FastBuildings.git"; rev = "1f5cfebc2f42c13e272bff639ffa3449d5740bf7"; sha256="0sry1n2pliddz0pjv8dp899fx98f16n1arc8zvq36k5grvi52fby"; }
+{ url = "https://github.com/modelica-3rdparty/FaultTriggering.git"; rev = "10c226b7e5b2af901b356ac437c90d6616a6e9a4"; sha256="0a9j18qjwigq11nghl97syxa9bscs1aj6vwpkldh50csnj5h6g2s"; }
+{ url = "https://github.com/modelica-3rdparty/FuzzyControl.git"; rev = "19ff67ff129a440482cc85f216f287b05ea6ec0d"; sha256="0ijcqns7pijsavijn4wlrdsz64k5ks626sly7r28wvrk9af2m2cx"; }
+{ url = "https://github.com/modelica-3rdparty/HelmholtzMedia.git"; rev = "e54fcd0e436d65c85de6c6b935983e363cdc9f6c"; sha256="05afh0379fx4mjjn7jb8j5p4am6qi62hjxvasb38b6fcp9rnysn4"; }
+{ url = "https://github.com/modelica-3rdparty/IdealizedContact.git"; rev = "8ebac550d913f6d2b3af4d1aea5044e72c7eb6b0"; sha256="03gh2a7hf44clshwkiyz786w847hmyr3bicdqd9969fbirgcqn6m"; }
+{ url = "https://github.com/modelica-3rdparty/IndustrialControlSystems.git"; rev = "6a2414307d5998c6d081efe803c2b575a532b3ba"; sha256="09la9h07x8bkh7zhrwykgj1467qdryjvxhvnnm8qvsim0dl9inc4"; }
+{ url = "https://github.com/modelica-3rdparty/LinearMPC.git"; rev = "1e91a5dcaa662cd30c5b09a9d0267289703f933b"; sha256="12094fqmwi65h0mc65b96krbj6b8dgn6jiww3fnv6khglb21kwvd"; }
+{ url = "https://github.com/modelica/Modelica.git"; rev = "refs/tags/v1.6"; sha256="106w83ylgbxf63wr7p9z5q8vqz2qcsaw0zwaad7d3saq6rdbj30c"; }
+{ url = "https://github.com/modelica/Modelica.git"; rev = "d442bcd461b8db9873e33b6141bdbd37bcff9de8"; sha256="1icnd0fxix5khnsvdhy7kmzn6lnqkggbvfrbln98a2h5zqd6s32w"; }
+{ url = "https://github.com/modelica/Modelica.git"; rev = "af2a3e1597d648d6826665c89cf9eaf5c2a632bc"; sha256="0ryk0iwakdazhsjqvan41w6f9bvgl329zkqchcdg6nkidiigziwh"; }
+{ url = "https://github.com/modelica/Modelica.git"; rev = "48943d87db45a6c312b5a5789d384acde44a934b"; sha256="1hi2vkpmx734baa9m1lqzallcykhh3snd68r387gndiv96f6zx3n"; }
+{ url = "https://github.com/modelica/Modelica.git"; rev = "164af873cc5955c50f9592a7d2f3c155f703849c"; sha256="071svqwd72sy85sngbg5r22ab693c0gw2xx29gk1sqrk2nchmvia"; }
+{ url = "https://github.com/OpenModelica/modelica3d.git"; rev = "daf5669b03ad33fc6999671d1c0e7521134a282b"; sha256="1scs6v2cp2r4jz4diszwbqf9kvzf49pid50dmpsz0gfhx06j9y2v"; }
+{ url = "https://github.com/modelica-deprecated/ModelicaAdditions.git"; rev = "568db43766186826b880f9d4bfafeff25cc2c4ab"; sha256="1py5i3afxdvz1dmxxwb2mqj8kyzdhg4jnnqwl8h50akizg4i49pl"; }
+{ url = "https://github.com/xogeny/ModelicaBook.git"; rev = "0e670cfae4db653bd34ea777d6b56423e9be2c9f"; sha256="0lxh08w6nii4p5yk7c0xmfi5y4xkjkzz4hirr3kqdhdfybcwq824"; }
+{ url = "https://github.com/modelica-compliance/compliance.git"; rev = "ca5092c14bb7af4507a10700ee49181a3a3ee199"; sha256="12ja6dhwlbq412kxjdviypgchipxpsg8l0sf6r17g6lbsi19i2b6"; }
+{ url = "https://github.com/modelica-3rdparty/ModelicaDEVS.git"; rev = "a987aa9552fbbe71b2ee2e8c28958f9d213087ae"; sha256="0qcw7vw28xadim0h8kr2km09d8vdj05ibdpzcnpny9n43pm9s5hx"; }
+{ url = "https://github.com/modelica/Modelica_DeviceDrivers.git"; rev = "db912ba7e1317b8f6a776ccf9a19f69c77a9c477"; sha256="052h2lr7xgfag5fks19wbldqmb985kxlc5fzysl7c9w3fnijp0ml"; }
+{ url = "https://github.com/modelica/Modelica_EnergyStorages.git"; rev = "9f057365232364e31a31a8e525f96284b98c7de3"; sha256="195m5b3z8qgg9kih9zsdx1h8zgrm37q63890r59akka05a97j48h"; }
+{ url = "https://github.com/modelica/Modelica_LinearSystems2.git"; rev = "18916fdc485285baab12481701b53d4eb606a3f1"; sha256="0fhvdwcgk8q3z1a98l2bxv8a6dysrs4ll6xfyzpni7yq8gp4mg4q"; }
+{ url = "https://github.com/modelica/Modelica_Synchronous.git"; rev = "d0f5ee57bc7b639738e88026674a87343b33dbe1"; sha256="0l75v4d0fgf07ify0h3skh4y9pfw9gxh9hbj1lbsdgglmzlrcvbg"; }
+{ url = "https://github.com/modelica-3rdparty/MotorcycleDynamics.git"; rev = "2be2667f9936d88ffb9b8a8246c5af9ccb0b307f"; sha256="0jazwmpqpyhhgs9qdn9drmplgp2yjs0ky7wll5x9929dkgy80m6x"; }
+{ url = "https://github.com/modelica-3rdparty/NCLib.git"; rev = "ed3d72f176ac6b7031ce73be9d80101141e74a69"; sha256="1pbpv8w1lsa9vdwp7qbih8iim91ms22b01wz376b548d0x2r95la"; }
+{ url = "https://github.com/modelica-3rdparty/NeuralNetwork.git"; rev = "c44e4d1fe97fd4f86dafcd05ad3713692e3f1806"; sha256="0s1v8k71zq1s9gjlvi3zr23nwfknp4x17cxm64a0y3vsi3kahj2s"; }
+{ url = "https://github.com/DLR-SR/Noise.git"; rev = "9b57476845539e56769cf76ea0fe7bf3c7eb5d11"; sha256="0icrb63f6dm4gww2nyby9i7s7qxvhvialp36xzcgmi7nlq7crjr2"; }
+{ url = "https://github.com/modelica-3rdparty/ObjectStab.git"; rev = "2a723e0b223af50f4ffdd62f8ac901e0f87b9323"; sha256="1b6zi27slzzfbkmbcqxygsn5i5w0zkq0hfrfb72vf7mbgz07j19j"; }
+{ url = "https://github.com/cparedis/OpenHydraulics.git"; rev = "d3173d1f06f7d14c9d7c41769f143617ff03a3ad"; sha256="1hn5rcnmzcbiaqdnxfn02wddmrpj9bcdi9p680f31hbh3vb0i3r6"; }
+{ url = "https://github.com/lochel/PNlib.git"; rev = "44c7d277980b7a88b449b72edec0a56416b40fa9"; sha256="026wdhbxnzarmj8gw0as70vj8f1gwc51z38hjqpswxkl0xd6mfvp"; }
+{ url = "https://github.com/MarekMatejak/Physiolibrary.git"; rev = "49d59060f6e5b4cb68560c6d7467e84ea4318056"; sha256="0klqs2axjm3s780sq4plq4wmbf9mszz2jmq9fprgxy9pw7iszbhc"; }
+{ url = "https://github.com/dzimmer/PlanarMechanics.git"; rev = "d998a1b27355e83d2ff4849d71281a919a3234aa"; sha256="0vyq6mninn38wy2d60rk753xbkfqim2y6y31py7kq2mm170jfqf4"; }
+{ url = "https://github.com/modelica/PowerSystems.git"; rev = "7b551888089277a0dd979db636d47aba0279e8f0"; sha256="0y13f1nllc7riksnly25wmmp6mc30c1b48dbq2lr1nag6yg3blwm"; }
+{ url = "https://github.com/modelica/PowerSystems.git"; rev = "3abd48aa53bbcd3f3e2ddfa2371680febf8baf48"; sha256="1nr2nbpaxywk8cpwnk9rr2zr87mm2gb9b4plqipjdlrrkjlk9fka"; }
+{ url = "https://github.com/modelica-3rdparty/PraxisSimulationstechnik.git"; rev = "f7db177786f84033f3a50b7474988b190a1dfb46"; sha256="08bdm7k7w35kg9gkrvcn382zkwf5h3iwkkx60d5fj64j5d5klray"; }
+{ url = "https://github.com/modelica-3rdparty/QCalc.git"; rev = "af6c34dda691a9bdf7ca1de10650974b2d5cecf5"; sha256="0p0zhl27cnr492byrzib0dyn7zp5yb7wcr0spv10ngm6j90cij6y"; }
+{ url = "https://github.com/modelica-3rdparty/QSSFluidFlow.git"; rev = "d84a2c107132f2cd47ea3c3751238d69e4b1f64b"; sha256="02cdvv33pi0qlmg8n401s4cxf59l9b4ff4ixf7gwn4w4n1y9bw0g"; }
+{ url = "https://github.com/modelica-3rdparty/RealTimeCoordinationLibrary.git"; rev = "655ac1a22aa6deb04ea8e3869dd0aa9fb9540754"; sha256="19crf8pl9vpqq3pq1rhcbl49kkmnm4jrzpwrpqp8qc6dj8096za4"; }
+{ url = "https://github.com/modelica-3rdparty/ScalableTestSuite.git"; rev = "c6319908d45ac97ffb10e96cd42654bce36ffb97"; sha256="1g79d88bfmzcqvaghyyj86ajs38v0qnmjxbj8d53yp6nmgnaasx5"; }
+{ url = "https://github.com/modelica-3rdparty/Servomechanisms.git"; rev = "22e1874ef9ad46156617817c67a4fb1238621bf5"; sha256="0nwb7apayk7ba9iv27yv67wi4b934dy57kkvn0acxy393jhd8jqd"; }
+{ url = "https://openmodelica.org/git/SiemensPower.git"; rev = "73a3bfc6d2ddd72165bb0f3e7e9df48b643a5ed0"; sha256="0mvrkpkmr0bx2cvsb23syg7cs8k6a15vjf4n1hivdcigq4x8g2nc"; }
+{ url = "https://openmodelica.org/git/SiemensPower.git"; rev = "5ef2e38b64ff481801c0db19d52f0bef21f85f77"; sha256="1llnpl2x1g28gari1rk34hdnnwf7a4fwwxlf7i18d8bl1vsrfaja"; }
+{ url = "https://openmodelica.org/git/SiemensPower.git"; rev = "2bd9e367baaa8d44946897c3c3a32a4050ad2a2a"; sha256="1shm9blpn9m87ci6wwkinpmihr1fik9j0a0pj2nxy0cjrr2jzbn4"; }
+{ url = "https://github.com/modelica-3rdparty/Spot.git"; rev = "2f74417f1681570900a1ed373dcbe4b42634ec7b"; sha256="0k5h2k6x98zvvsafpw7y16xs9d6lxz0csa0mlm4wwggaywadn255"; }
+{ url = "https://github.com/modelica-3rdparty/SystemDynamics.git"; rev = "c58a26dc3e62a50e64fd336dc4aa499b2d5ad314"; sha256="0ra3a2vgqmry92kmm060gfa41mrpkgbs4swzl78ih3icawfzjz8q"; }
+{ url = "https://github.com/modelica-3rdparty/ThermoPower.git"; rev = "e012268625dd1645fe5570cf31d64129d83a8192"; sha256="1rlkli48kc9hnkplgb0bjkb6ajn7agiw4yh9l5sfvlv7k7k2gc8l"; }
+{ url = "https://openmodelica.org/git/ThermoSysPro.git"; rev = "d4f9c3ed35f7520f82439eb6e9f4057ae0f82b73"; sha256="0hxbn26g479qkr6rrglx9ljdxnpzd5ll1sf2v08skghrdjjb8jcx"; }
+{ url = "https://openmodelica.org/git/ThermoSysPro.git"; rev = "51e7ea2d2e121ee640e7897335c294923f8eaeb0"; sha256="0l11mzjkaxndsqrnnr0z7qvk08svv229119qkm81yb53ich9wnyw"; }
+{ url = "https://github.com/modelica/VehicleInterfaces.git"; rev = "ad956a35643d53e207ee126d67ea1f3f38337a39"; sha256="0g90cqwjpi06gn7vca5kqnz56im76s2hrdqjhsj2bl43rza8mhr0"; }
+{ url = "https://github.com/modelica-3rdparty/WasteWater.git"; rev = "90ff44ac791ba5ed98444c8597efbd2a2af01cad"; sha256="1icrn0y389rhxmf6i0mnsfgw9v9j5innpkz3q069rfm2ji268b12"; }
+{ url = "https://github.com/xogeny/XogenyTest.git"; rev = "9b98981e8ff0f440dd319d1a806e1fd2f0ab3436"; sha256="18glaxrlxfml26w7ljlf0yj3ah1fnhpbg01py28nplsgnrfwfwqj"; }
+{ url = "https://github.com/modelica-3rdparty/msgpack-modelica.git"; rev = "6ce2ca600c4902038c0f20b43ed442f1ee204310"; sha256="01x5a9y11yf62sc0j2y49yxwm24imj2lfl3z5mwvi9038gwn0lkx"; }
+{ url = "https://github.com/modelica-3rdparty/netCDF-DataReader.git"; rev = "3d2cc8272abfbc4b667d8868f851bf3e11c6f00e"; sha256="194810a4rn0flxgirrlnxsbxarnm97309dkp1w7nva9zv1q3wj7h"; }
+{ url = "https://github.com/joewa/open-bldc-modelica.git"; rev = "7817cd703b88fc1f433269d32c31e75eb50a21c6"; sha256="1plkxkx51f9yi99ysarmx2ymldizvyr0m66k996y5lj5h81jv8a8"; }
+]
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-svn.nix b/nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-svn.nix
new file mode 100644
index 000000000000..244da64fb4e6
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/src-libs-svn.nix
@@ -0,0 +1,5 @@
+[
+{ url = "https://svn.modelica.org/projects/Modelica_ElectricalSystems/InstantaneousSymmetricalComponents"; rev = "7978"; sha256="0f100c7bz4ai3ryhpkbbszw8z6mykvg40p03ic92n2qq58wjk37z"; }
+{ url = "https://svn.modelica.org/projects/Modelica_EmbeddedSystems/trunk/Modelica_StateGraph2"; rev = "8121"; sha256="1cys57nc1yzkr5admc139qs5pa48rj3g69pb3j3s9xcmpd483hzp"; }
+{ url = "https://svn.modelica.org/projects/Modelica_ElectricalSystems/Modelica_PowerFlow/trunk"; rev = "3174"; sha256="0yviw1b8psn8vfyl4q1naylak3lcqi2q1bqplqg3gg9iw4aiymxl"; }
+]
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/src-main.nix b/nixpkgs/pkgs/applications/science/misc/openmodelica/src-main.nix
new file mode 100644
index 000000000000..99e82259bfe6
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/src-main.nix
@@ -0,0 +1,6 @@
+{
+  url = "https://openmodelica.org/git-readonly/OpenModelica.git";
+  fetchSubmodules = true;
+  rev = "8c5d48eb31a638d5220621b20377bfe6f9e9535e";
+  sha256 = "0i5cznkh4wwayjqms14f3phizqm493nrr1yjgs9747nfw7vnwsff";
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-git.sh b/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-git.sh
new file mode 100755
index 000000000000..481a89796415
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-git.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+CWD=`pwd`
+
+chko() { (
+T=`mktemp -d`
+trap "rm -rf $T" EXIT INT PIPE
+cd $T
+cat >check.nix <<EOF
+with import <nixpkgs> {};
+fetchgit `cat $CWD/src-main.nix`
+EOF
+nix-build check.nix
+cat result/libraries/Makefile.libs
+) }
+
+getsha256() { (
+T=`mktemp -d`
+trap "rm -rf $T" EXIT INT PIPE
+cd $T
+
+L=`echo $2 | wc -c`
+if expr $L '<' 10 >/dev/null; then
+T=`echo $2 | sed 's@"\(.*\)"@"refs/tags/\1"@'`
+cat >check.nix <<EOF
+with import <nixpkgs> {};
+fetchgit {
+  url = $1;
+  rev = $T;
+  sha256 = "0000000000000000000000000000000000000000000000000000";
+}
+EOF
+SHA=`nix-build check.nix 2>&1 | sed -n 's/.*instead has ‘\(.*\)’.*/\1/g p'`
+echo "{ url = $1; rev = $T; sha256=\"$SHA\"; }"
+else
+cat >check.nix <<EOF
+with import <nixpkgs> {};
+fetchgit {
+  url = $1;
+  rev = $2;
+  sha256 = "0000000000000000000000000000000000000000000000000000";
+}
+EOF
+SHA=`nix-build check.nix 2>&1 | sed -n 's/.*instead has ‘\(.*\)’.*/\1/g p'`
+echo "{ url = $1; rev = $2; sha256=\"$SHA\"; }"
+fi
+
+# nix-build check.nix
+) }
+
+OUT=src-libs-git.nix
+
+echo '[' > $OUT
+
+chko |
+grep checkout-git.sh |
+tr \' \" |
+while read NM TGT URL BR REV ; do
+  echo Trying $TGT $URL $REV >&2
+  getsha256 $URL $REV >> $OUT || exit 1
+done
+
+echo ']' >> $OUT
+
diff --git a/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-svn.sh b/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-svn.sh
new file mode 100755
index 000000000000..972bc7d61f13
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-svn.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+CWD=`pwd`
+
+chko() { (
+T=`mktemp -d`
+trap "rm -rf $T" EXIT INT PIPE
+cd $T
+cat >check.nix <<EOF
+with import <nixpkgs> {};
+fetchgit `cat $CWD/src-main.nix`
+EOF
+nix-build check.nix
+cat result/libraries/Makefile.libs
+) }
+
+getsha256() { (
+T=`mktemp -d`
+trap "rm -rf $T" EXIT INT PIPE
+cd $T
+
+L=`echo $2 | wc -c`
+cat >check.nix <<EOF
+with import <nixpkgs> {};
+fetchsvn {
+  url = $1;
+  rev = $2;
+  sha256 = "0000000000000000000000000000000000000000000000000000";
+}
+EOF
+SHA=`nix-build check.nix 2>&1 | sed -n 's/.*instead has ‘\(.*\)’.*/\1/g p'`
+echo "{ url = $1; rev = $2; sha256=\"$SHA\"; }"
+
+# nix-build check.nix
+) }
+
+OUT=src-libs-svn.nix
+
+echo '[' > $OUT
+
+chko |
+grep checkout-svn.sh |
+tr \' \" |
+while read NM TGT URL REV ; do
+  echo Trying $TGT $URL $REV >&2
+  getsha256 $URL $REV >> $OUT || exit 1
+done
+
+echo ']' >> $OUT
+
diff --git a/nixpkgs/pkgs/applications/science/misc/openmvg/default.nix b/nixpkgs/pkgs/applications/science/misc/openmvg/default.nix
new file mode 100644
index 000000000000..5db6092fa36d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmvg/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, pkgconfig, cmake
+, libjpeg ? null
+, zlib ? null
+, libpng ? null
+, eigen ? null
+, libtiff ? null
+, enableExamples ? false
+, enableDocs ? false }:
+
+stdenv.mkDerivation rec {
+  version = "1.6";
+  pname = "openmvg";
+
+  src = fetchFromGitHub {
+    owner = "openmvg";
+    repo = "openmvg";
+    rev = "v${version}";
+    sha256 = "0mrsi0dzgi7cjzn13r9xv7rnc8c9a4h8ip78xy88m9xsyr21wd1h";
+    fetchSubmodules = true;
+  };
+
+  buildInputs = [ libjpeg zlib libpng eigen libtiff ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  cmakeFlags = [
+    "-DCMAKE_CXX_FLAGS=-std=c++11"
+    "-DOpenMVG_BUILD_EXAMPLES=${if enableExamples then "ON" else "OFF"}"
+    "-DOpenMVG_BUILD_DOC=${if enableDocs then "ON" else "OFF"}"
+  ];
+
+  cmakeDir = "./src";
+
+  dontUseCmakeBuildDir = true;
+
+  # This can be enabled, but it will exhause virtual memory on most machines.
+  enableParallelBuilding = false;
+
+  # Without hardeningDisable, certain flags are passed to the compile that break the build (primarily string format errors)
+  hardeningDisable = [ "all" ];
+
+  meta = {
+    description = "A library for computer-vision scientists and targeted for the Multiple View Geometry community";
+    homepage = "https://openmvg.readthedocs.io/en/latest/";
+    license = stdenv.lib.licenses.mpl20;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = with stdenv.lib.maintainers; [ mdaiter ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/openmvs/default.nix b/nixpkgs/pkgs/applications/science/misc/openmvs/default.nix
new file mode 100644
index 000000000000..efdd86f0ab2d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/openmvs/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchFromGitHub, pkgconfig, cmake
+, eigen, opencv, ceres-solver, cgal, boost, vcg
+, gmp, mpfr, glog, gflags, libjpeg_turbo }:
+
+stdenv.mkDerivation {
+  name = "openmvs-unstable-2018-05-26";
+
+  src = fetchFromGitHub {
+    owner = "cdcseacave";
+    repo = "openmvs";
+    rev = "939033c55b50478339084431aac2c2318041afad";
+    sha256 = "12dgkwwfdp24581y3i41gsd1k9hq0aw917q0ja5s0if4qbmc8pni";
+  };
+
+  buildInputs = [ eigen opencv ceres-solver cgal boost vcg gmp mpfr glog gflags libjpeg_turbo ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  preConfigure = ''
+    cmakeFlagsArray=(
+      $cmakeFlagsArray
+      "-DCMAKE_CXX_FLAGS=-std=c++11"
+      "-DBUILD_SHARED_LIBS=ON"
+      "-DBUILD_STATIC_RUNTIME=ON"
+      "-DINSTALL_BIN_DIR=$out/bin"
+      "-DVCG_DIR=${vcg}"
+      "-DCGAL_ROOT=${cgal}/lib/cmake/CGAL"
+      "-DCERES_DIR=${ceres-solver}/lib/cmake/Ceres/"
+    )
+  '';
+
+  postFixup = ''
+    rp=$(patchelf --print-rpath $out/bin/DensifyPointCloud)
+    patchelf --set-rpath $rp:$out/lib/OpenMVS $out/bin/DensifyPointCloud
+
+    rp=$(patchelf --print-rpath $out/bin/InterfaceVisualSFM)
+    patchelf --set-rpath $rp:$out/lib/OpenMVS $out/bin/InterfaceVisualSFM
+
+    rp=$(patchelf --print-rpath $out/bin/ReconstructMesh)
+    patchelf --set-rpath $rp:$out/lib/OpenMVS $out/bin/ReconstructMesh
+
+    rp=$(patchelf --print-rpath $out/bin/RefineMesh)
+    patchelf --set-rpath $rp:$out/lib/OpenMVS $out/bin/RefineMesh
+
+    rp=$(patchelf --print-rpath $out/bin/TextureMesh)
+    patchelf --set-rpath $rp:$out/lib/OpenMVS $out/bin/TextureMesh
+  '';
+
+  cmakeDir = "./";
+
+  dontUseCmakeBuildDir = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A library for computer-vision scientists and especially targeted to the Multi-View Stereo reconstruction community";
+    homepage = "http://cdcseacave.github.io/openMVS/";
+    license = licenses.agpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ mdaiter ];
+    # 20190414-174115: CMake cannot find CGAL which is passed as build input
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/rink/default.nix b/nixpkgs/pkgs/applications/science/misc/rink/default.nix
new file mode 100644
index 000000000000..b868706a05f9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/rink/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, rustPlatform, openssl, pkg-config, ncurses }:
+
+rustPlatform.buildRustPackage rec {
+  version = "0.5.1";
+  pname = "rink";
+
+  src = fetchFromGitHub {
+    owner = "tiffany352";
+    repo = "rink-rs";
+    rev = "v${version}";
+    sha256 = "1s67drjzd4cf93hpm7b2facfd6y1x0s60aq6pygj7i02bm0cb9l9";
+  };
+
+  cargoSha256 = "1wd70y13lly7nccaqlv7w8znxfal0fzyf9d67y5c3aikj7hkzfin";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ openssl ncurses ];
+
+  # Some tests fail and/or attempt to use internet servers.
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Unit-aware calculator";
+    homepage = "https://rinkcalc.app";
+    license = with licenses; [ mpl20 gpl3 ];
+    maintainers = with maintainers; [ sb0 filalex77 ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/root/5.nix b/nixpkgs/pkgs/applications/science/misc/root/5.nix
new file mode 100644
index 000000000000..cab26577bd0b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/5.nix
@@ -0,0 +1,91 @@
+{ stdenv, fetchurl, fetchpatch, cmake, pcre, pkgconfig, python2
+, libX11, libXpm, libXft, libXext, libGLU, libGL, zlib, libxml2, lz4, lzma, gsl_1, xxHash
+, Cocoa, OpenGL, noSplash ? false }:
+
+stdenv.mkDerivation rec {
+  pname = "root";
+  version = "5.34.38";
+
+  src = fetchurl {
+    url = "https://root.cern.ch/download/root_v${version}.source.tar.gz";
+    sha256 = "1ln448lszw4d6jmbdphkr2plwxxlhmjkla48vmmq750xc1lxlfrc";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake pcre python2 zlib libxml2 lz4 lzma gsl_1 xxHash ]
+    ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ]
+    ++ stdenv.lib.optionals (stdenv.isDarwin) [ Cocoa OpenGL ]
+    ;
+
+  patches = [
+    ./sw_vers_root5.patch
+
+    # prevents rootcint from looking in /usr/includes and such
+    ./purify_include_paths_root5.patch
+
+    # disable dictionary generation for stuff that includes libc headers
+    # our glibc requires a modern compiler
+    ./disable_libc_dicts_root5.patch
+  ];
+
+  preConfigure = ''
+    patchShebangs build/unix/
+    ln -s ${stdenv.lib.getDev stdenv.cc.libc}/include/AvailabilityMacros.h cint/cint/include/
+  ''
+  # Fix CINTSYSDIR for "build" version of rootcint
+  # This is probably a bug that breaks out-of-source builds
+  + ''
+    substituteInPlace cint/cint/src/loadfile.cxx\
+      --replace 'env = "cint";' 'env = "'`pwd`'/cint";'
+  '' + stdenv.lib.optionalString noSplash ''
+    substituteInPlace rootx/src/rootx.cxx --replace "gNoLogo = false" "gNoLogo = true"
+  '';
+
+  cmakeFlags = [
+    "-Drpath=ON"
+    "-DCMAKE_INSTALL_LIBDIR=lib"
+    "-DCMAKE_INSTALL_INCLUDEDIR=include"
+    "-Dalien=OFF"
+    "-Dbonjour=OFF"
+    "-Dcastor=OFF"
+    "-Dchirp=OFF"
+    "-Ddavix=OFF"
+    "-Ddcache=OFF"
+    "-Dfftw3=OFF"
+    "-Dfitsio=OFF"
+    "-Dfortran=OFF"
+    "-Dgfal=OFF"
+    "-Dgsl_shared=ON"
+    "-Dgviz=OFF"
+    "-Dhdfs=OFF"
+    "-Dkrb5=OFF"
+    "-Dldap=OFF"
+    "-Dmathmore=ON"
+    "-Dmonalisa=OFF"
+    "-Dmysql=OFF"
+    "-Dodbc=OFF"
+    "-Dopengl=ON"
+    "-Doracle=OFF"
+    "-Dpgsql=OFF"
+    "-Dpythia6=OFF"
+    "-Dpythia8=OFF"
+    "-Drfio=OFF"
+    "-Dsqlite=OFF"
+    "-Dssl=OFF"
+    "-Dxml=ON"
+    "-Dxrootd=OFF"
+  ]
+  ++ stdenv.lib.optional stdenv.isDarwin "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks";
+
+  enableParallelBuilding = true;
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with stdenv.lib; {
+    homepage = "https://root.cern.ch/";
+    description = "A data analysis framework";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/root/default.nix b/nixpkgs/pkgs/applications/science/misc/root/default.nix
new file mode 100644
index 000000000000..97d8d4e7cee5
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/default.nix
@@ -0,0 +1,92 @@
+{ stdenv, lib, fetchurl, makeWrapper, cmake, gl2ps, gsl, libX11, libXpm, libXft
+, libXext, libGLU, libGL, libxml2, lz4, lzma, pcre, pkgconfig, python, xxHash
+, zlib
+, Cocoa, OpenGL, noSplash ? false }:
+
+stdenv.mkDerivation rec {
+  pname = "root";
+  version = "6.18.04";
+
+  src = fetchurl {
+    url = "https://root.cern.ch/download/root_v${version}.source.tar.gz";
+    sha256 = "196ghma6g5a7sqz52wyjkgvmh4hj4vqwppm0zwdypy33hgy8anii";
+  };
+
+  nativeBuildInputs = [ makeWrapper cmake pkgconfig ];
+  buildInputs = [ gl2ps pcre zlib libxml2 lz4 lzma gsl xxHash python.pkgs.numpy ]
+    ++ lib.optionals (!stdenv.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ]
+    ++ lib.optionals (stdenv.isDarwin) [ Cocoa OpenGL ]
+    ;
+
+  patches = [
+    ./sw_vers.patch
+  ];
+
+  preConfigure = ''
+    rm -rf builtins/*
+    substituteInPlace cmake/modules/SearchInstalledSoftware.cmake \
+      --replace 'set(lcgpackages ' '#set(lcgpackages '
+
+    patchShebangs build/unix/
+  '' + stdenv.lib.optionalString noSplash ''
+    substituteInPlace rootx/src/rootx.cxx --replace "gNoLogo = false" "gNoLogo = true"
+  '';
+
+  cmakeFlags = [
+    "-Drpath=ON"
+    "-DCMAKE_INSTALL_LIBDIR=lib"
+    "-DCMAKE_INSTALL_INCLUDEDIR=include"
+    "-Dalien=OFF"
+    "-Dbonjour=OFF"
+    "-Dcastor=OFF"
+    "-Dchirp=OFF"
+    "-Dclad=OFF"
+    "-Ddavix=OFF"
+    "-Ddcache=OFF"
+    "-Dfail-on-missing=ON"
+    "-Dfftw3=OFF"
+    "-Dfitsio=OFF"
+    "-Dfortran=OFF"
+    "-Dimt=OFF"
+    "-Dgfal=OFF"
+    "-Dgviz=OFF"
+    "-Dhdfs=OFF"
+    "-Dkrb5=OFF"
+    "-Dldap=OFF"
+    "-Dmonalisa=OFF"
+    "-Dmysql=OFF"
+    "-Dodbc=OFF"
+    "-Dopengl=ON"
+    "-Doracle=OFF"
+    "-Dpgsql=OFF"
+    "-Dpythia6=OFF"
+    "-Dpythia8=OFF"
+    "-Drfio=OFF"
+    "-Dsqlite=OFF"
+    "-Dssl=OFF"
+    "-Dvdt=OFF"
+    "-Dxml=ON"
+    "-Dxrootd=OFF"
+  ]
+  ++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.lib.getDev stdenv.cc.libc}/include"
+  ++ stdenv.lib.optional stdenv.isDarwin "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks";
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    for prog in rootbrowse rootcp rooteventselector rootls rootmkdir rootmv rootprint rootrm rootslimtree; do
+      wrapProgram "$out/bin/$prog" \
+        --prefix PYTHONPATH : "$out/lib"
+    done
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with stdenv.lib; {
+    homepage = "https://root.cern.ch/";
+    description = "A data analysis framework";
+    platforms = platforms.unix;
+    maintainers = [ maintainers.veprbl ];
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/root/disable_libc_dicts_root5.patch b/nixpkgs/pkgs/applications/science/misc/root/disable_libc_dicts_root5.patch
new file mode 100644
index 000000000000..abd6222847ef
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/disable_libc_dicts_root5.patch
@@ -0,0 +1,27 @@
+diff --git a/cint/ROOT/CMakeLists.txt b/cint/ROOT/CMakeLists.txt
+--- a/cint/ROOT/CMakeLists.txt
++++ b/cint/ROOT/CMakeLists.txt
+@@ -47,21 +47,13 @@ set(CINTSTLDLLHEADERS
+     ${CMAKE_SOURCE_DIR}/cint/cint/lib/stdstrct/stdcxxfunc.h
+   )
+ set(CINTINCDLLNAMES 
+-    stdfunc 
++#    stdfunc 
+ #    stdcxxfunc
+    )
+ set(CINTINCDLLHEADERS
+-    ${CMAKE_SOURCE_DIR}/cint/cint/lib/stdstrct/stdfunc.h 
++#    ${CMAKE_SOURCE_DIR}/cint/cint/lib/stdstrct/stdfunc.h 
+ #    ${CMAKE_SOURCE_DIR}/cint/cint/lib/stdstrct/stdcxxfunc.h
+    )
+-if(NOT WIN32)
+-  set(CINTSTLDLLNAMES ${CINTSTLDLLNAMES}  valarray)
+-  set(CINTSTLDLLHEADERS ${CINTSTLDLLHEADERS} ${CINTDLLDIR}/vary.h)
+-  set(CINTINCDLLNAMES ${CINTINCDLLNAMES} posix ipc)
+-  set(CINTINCDLLHEADERS ${CINTINCDLLHEADERS} 
+-    ${CMAKE_SOURCE_DIR}/cint/cint/lib/posix/exten.h 
+-    ${CMAKE_SOURCE_DIR}/cint/cint/lib/ipc/ipcif.h)
+-endif()
+ 
+ set(CINTBUILDLOADER
+     vector 
diff --git a/nixpkgs/pkgs/applications/science/misc/root/purify_include_paths_root5.patch b/nixpkgs/pkgs/applications/science/misc/root/purify_include_paths_root5.patch
new file mode 100644
index 000000000000..6773603b8ad3
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/purify_include_paths_root5.patch
@@ -0,0 +1,204 @@
+diff --git a/cint/cint/src/loadfile.cxx b/cint/cint/src/loadfile.cxx
+--- a/cint/cint/src/loadfile.cxx
++++ b/cint/cint/src/loadfile.cxx
+@@ -1365,92 +1365,6 @@ int G__statfilename(const char *filenamein, struct stat *statBuf,
+          }
+       }         
+ #endif /* G__EDU_VERSION */
+-      
+-#ifdef G__VISUAL
+-      /**********************************************
+-       * try /msdev/include
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         workname.Format("/msdev/include/%s%s",filename(),addpost[i2]);
+-         res = stat( workname, statBuf );         
+-         if (res==0) {
+-            if (fullPath) fullPath->Swap(workname);
+-            return res;
+-         }
+-      }
+-#endif /* G__VISUAL */
+-         
+-#ifdef G__SYMANTEC
+-      /**********************************************
+-       * try /sc/include
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         workname.Format("/sc/include/%s%s",filename(),addpost[i2]);
+-         res = stat( workname, statBuf );         
+-         if (res==0) {
+-            if (fullPath) fullPath->Swap(workname);
+-            return res;
+-         }
+-      }
+-#endif // G__SYMANTEC
+-         
+-#ifndef G__WIN32
+-      /**********************************************
+-       * try /usr/include/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         workname.Format("/usr/include/%s%s",filename(),addpost[i2]);
+-         res = stat( workname, statBuf );         
+-         if (res==0) {
+-            if (fullPath) fullPath->Swap(workname);
+-            return res;
+-         }
+-      }
+-#endif
+-      
+-#ifdef __GNUC__
+-      /**********************************************
+-       * try /usr/include/g++/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         workname.Format("/usr/include/g++/%s%s",filename(),addpost[i2]);
+-         res = stat( workname, statBuf );         
+-         if (res==0) {
+-            if (fullPath) fullPath->Swap(workname);
+-            return res;
+-         }
+-      }
+-#endif /* __GNUC__ */
+-      
+-#ifndef G__WIN32
+-      /* #ifdef __hpux */
+-      /**********************************************
+-       * try /usr/include/CC/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         workname.Format("/usr/include/CC/%s%s",filename(),addpost[i2]);
+-         res = stat( workname, statBuf );         
+-         if (res==0) {
+-            if (fullPath) fullPath->Swap(workname);
+-            return res;
+-         }
+-      }         
+-#endif
+-         
+-#ifndef G__WIN32
+-      /**********************************************
+-       * try /usr/include/codelibs/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         workname.Format("/usr/include/codelibs/%s%s"
+-                         ,filename(),addpost[i2]);
+-         res = stat( workname, statBuf );         
+-         if (res==0) {
+-            if (fullPath) fullPath->Swap(workname);
+-            return res;
+-         }
+-      }
+-#endif
+    }
+    return -1;
+ }
+@@ -1960,107 +1874,6 @@ int G__loadfile(const char *filenamein)
+       }
+       if(G__ifile.fp) break;
+ #endif /* G__EDU_VERSION */
+-
+-#ifdef G__VISUAL
+-      /**********************************************
+-       * try /msdev/include
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         G__snprintf(G__ifile.name,G__MAXFILENAME,"/msdev/include/%s%s",filename(),addpost[i2]);
+-#ifndef G__WIN32
+-        G__ifile.fp = fopen(G__ifile.name,"r");
+-#else
+-        G__ifile.fp = fopen(G__ifile.name,"rb");
+-#endif
+-        G__globalcomp=G__store_globalcomp;
+-      }
+-      if(G__ifile.fp) break;
+-#endif /* G__VISUAL */
+-
+-#ifdef G__SYMANTEC
+-      /**********************************************
+-       * try /sc/include
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         G__snprintf(G__ifile.name,G__MAXFILENAME,"/sc/include/%s%s",filename(),addpost[i2]);
+-#ifndef G__WIN32
+-        G__ifile.fp = fopen(G__ifile.name,"r");
+-#else
+-        G__ifile.fp = fopen(G__ifile.name,"rb");
+-#endif
+-        G__globalcomp=G__store_globalcomp;
+-      }
+-      if(G__ifile.fp) break;
+-#endif /* G__SYMANTEC */
+-
+-#ifndef G__WIN32
+-      /**********************************************
+-       * try /usr/include/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         G__snprintf(G__ifile.name,G__MAXFILENAME,"/usr/include/%s%s",filename(),addpost[i2]);
+-#ifndef G__WIN32
+-        G__ifile.fp = fopen(G__ifile.name,"r");
+-#else
+-        G__ifile.fp = fopen(G__ifile.name,"rb");
+-#endif
+-        G__globalcomp=G__store_globalcomp;
+-      }
+-      if(G__ifile.fp) break;
+-#endif
+-
+-#ifdef __GNUC__
+-      /**********************************************
+-       * try /usr/include/g++/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         G__snprintf(G__ifile.name,G__MAXFILENAME,"/usr/include/g++/%s%s",filename(),addpost[i2]);
+-#ifndef G__WIN32
+-        G__ifile.fp = fopen(G__ifile.name,"r");
+-#else
+-        G__ifile.fp = fopen(G__ifile.name,"rb");
+-#endif
+-        G__globalcomp=G__store_globalcomp;
+-      }
+-      if(G__ifile.fp) break;
+-#endif /* __GNUC__ */
+-
+-#ifndef G__WIN32
+-/* #ifdef __hpux */
+-      /**********************************************
+-       * try /usr/include/CC/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-         G__snprintf(G__ifile.name,G__MAXFILENAME,"/usr/include/CC/%s%s",filename(),addpost[i2]);
+-#ifndef G__WIN32
+-        G__ifile.fp = fopen(G__ifile.name,"r");
+-#else
+-        G__ifile.fp = fopen(G__ifile.name,"rb");
+-#endif
+-        G__globalcomp=G__store_globalcomp;
+-      }
+-      if(G__ifile.fp) break;
+-/* #endif __hpux */
+-#endif
+-
+-#ifndef G__WIN32
+-/* #ifdef __hpux */
+-      /**********************************************
+-       * try /usr/include/codelibs/filename
+-       **********************************************/
+-      if('\0'!=G__cintsysdir[0]) {
+-        G__snprintf(G__ifile.name,G__MAXFILENAME,"/usr/include/codelibs/%s%s"
+-                    ,filename(),addpost[i2]);
+-#ifndef G__WIN32
+-        G__ifile.fp = fopen(G__ifile.name,"r");
+-#else
+-        G__ifile.fp = fopen(G__ifile.name,"rb");
+-#endif
+-        G__globalcomp=G__store_globalcomp;
+-      }
+-      if(G__ifile.fp) break;
+-/* #endif __hpux */
+-#endif
+     }
+   }
+ 
diff --git a/nixpkgs/pkgs/applications/science/misc/root/setup-hook.sh b/nixpkgs/pkgs/applications/science/misc/root/setup-hook.sh
new file mode 100644
index 000000000000..b26cf9b779f8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/setup-hook.sh
@@ -0,0 +1,13 @@
+thisroot () {
+    # Workaround thisroot.sh dependency on man
+    if [ -z "${MANPATH-}" ]; then
+        MANPATH=:
+    fi
+    local oldOpts="-u"
+    shopt -qo nounset || oldOpts="+u"
+    set +u
+    source @out@/bin/thisroot.sh
+    set "$oldOpts"
+}
+
+postHooks+=(thisroot)
diff --git a/nixpkgs/pkgs/applications/science/misc/root/sw_vers.patch b/nixpkgs/pkgs/applications/science/misc/root/sw_vers.patch
new file mode 100644
index 000000000000..34af132c11f8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/sw_vers.patch
@@ -0,0 +1,101 @@
+diff a/build/unix/compiledata.sh b/build/unix/compiledata.sh
+--- a/build/unix/compiledata.sh
++++ b/build/unix/compiledata.sh
+@@ -47,7 +47,7 @@ fi
+ 
+ if [ "$ARCH" = "macosx" ] || [ "$ARCH" = "macosx64" ] || \
+    [ "$ARCH" = "macosxicc" ]; then
+-   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
++   macosx_minor=12
+    SOEXT="so"
+    if [ $macosx_minor -ge 5 ]; then
+       if [ "x`echo $SOFLAGS | grep -- '-install_name'`" != "x" ]; then
+diff a/cmake/modules/SetUpMacOS.cmake b/cmake/modules/SetUpMacOS.cmake
+--- a/cmake/modules/SetUpMacOS.cmake
++++ b/cmake/modules/SetUpMacOS.cmake
+@@ -2,17 +2,8 @@ set(ROOT_ARCHITECTURE macosx)
+ set(ROOT_PLATFORM macosx)
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+-  EXECUTE_PROCESS(COMMAND sw_vers "-productVersion"
+-                  COMMAND cut -d . -f 1-2
+-                  OUTPUT_VARIABLE MACOSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-  MESSAGE(STATUS "Found a Mac OS X System ${MACOSX_VERSION}")
+-
+-  if(MACOSX_VERSION VERSION_GREATER 10.7 AND ${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
+     set(libcxx ON CACHE BOOL "Build using libc++" FORCE)
+-  endif()
+ 
+-  if(MACOSX_VERSION VERSION_GREATER 10.4)
+     #TODO: check haveconfig and rpath -> set rpath true
+     #TODO: check Thread, define link command
+     #TODO: more stuff check configure script
+@@ -25,23 +16,7 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
+        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
+        SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -m64")
+-    else()
+-       MESSAGE(STATUS "Found a 32bit system")
+-       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+-       SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -m32")
+-    endif()
+-  endif()
+-
+-  if(MACOSX_VERSION VERSION_GREATER 10.6)
+-    set(MACOSX_SSL_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.7)
+-    set(MACOSX_ODBC_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.8)
+-    set(MACOSX_GLU_DEPRECATED ON)
+-  endif()
++     endif()
+ 
+   if (CMAKE_COMPILER_IS_GNUCXX)
+      message(STATUS "Found GNU compiler collection")
+@@ -104,7 +79,6 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+   endif()
+ 
+   #---Set Linker flags----------------------------------------------------------------------
+-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=${MACOSX_VERSION}")
+ else (CMAKE_SYSTEM_NAME MATCHES Darwin)
+   MESSAGE(FATAL_ERROR "There is no setup for this this Apple system up to now. Don't know waht to do. Stop cmake at this point.")
+ endif (CMAKE_SYSTEM_NAME MATCHES Darwin)
+diff a/config/root-config.in b/config/root-config.in
+--- a/config/root-config.in
++++ b/config/root-config.in
+@@ -306,12 +306,6 @@ macosxicc)
+    auxlibs="-lm -ldl"
+    ;;
+ macosx64)
+-   # MacOS X with gcc (GNU cc v4.x) in 64 bit mode
+-   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
+-   # cannot find the one linked to libGraf if relocated after built
+-   if [ $macosx_minor -le 4 ]; then
+-      rootlibs="$rootlibs -lfreetype"
+-   fi
+    auxcflags="${cxxversionflag} -m64"
+    auxldflags="-m64"
+    auxlibs="-lm -ldl"
+@@ -375,18 +369,11 @@ freebsd* | openbsd* | linux*)
+ macosx*)
+    for f in $features ; do
+       if test "x$f" = "xthread" ; then
+-         if [ $macosx_minor -ge 5 ]; then
+             auxcflags="-pthread $auxcflags"
+             auxlibs="-lpthread $auxlibs"
+-         else
+-            auxcflags="-D_REENTRANT $auxcflags"
+-            auxlibs="-lpthread $auxlibs"
+-         fi
+       fi
+       if test "x$f" = "xrpath" ; then
+-         if [ $macosx_minor -ge 5 ]; then
+             auxlibs="-Wl,-rpath,$libdir $auxlibs"
+-         fi
+       fi
+       if test "x$f" = "xlibcxx" ; then
+          auxcflags="-stdlib=libc++ $auxcflags"
diff --git a/nixpkgs/pkgs/applications/science/misc/root/sw_vers_root5.patch b/nixpkgs/pkgs/applications/science/misc/root/sw_vers_root5.patch
new file mode 100644
index 000000000000..f044bed91f3d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/root/sw_vers_root5.patch
@@ -0,0 +1,104 @@
+diff --git a/build/unix/compiledata.sh b/build/unix/compiledata.sh
+--- a/build/unix/compiledata.sh
++++ b/build/unix/compiledata.sh
+@@ -49,7 +49,7 @@ fi
+ 
+ if [ "$ARCH" = "macosx" ] || [ "$ARCH" = "macosx64" ] || \
+    [ "$ARCH" = "macosxicc" ]; then
+-   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
++   macosx_minor=7
+    SOEXT="so"
+    if [ $macosx_minor -ge 5 ]; then
+       if [ "x`echo $SOFLAGS | grep -- '-install_name'`" != "x" ]; then
+diff --git a/cmake/modules/SetUpMacOS.cmake b/cmake/modules/SetUpMacOS.cmake
+--- a/cmake/modules/SetUpMacOS.cmake
++++ b/cmake/modules/SetUpMacOS.cmake
+@@ -12,25 +12,11 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/X11R6)
+ #---------------------------------------------------------------------------------------------------------
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+-  EXECUTE_PROCESS(COMMAND sw_vers "-productVersion"
+-                  COMMAND cut -d . -f 1-2
+-                  OUTPUT_VARIABLE MACOSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+-  MESSAGE(STATUS "Found a Mac OS X System ${MACOSX_VERSION}")
+-  EXECUTE_PROCESS(COMMAND sw_vers "-productVersion"
+-                  COMMAND cut -d . -f 2
+-                  OUTPUT_VARIABLE MACOSX_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-  if(MACOSX_VERSION VERSION_GREATER 10.7 AND ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
+     set(libcxx ON CACHE BOOL "Build using libc++" FORCE)
+-  endif()
+ 
+-  if(${MACOSX_MINOR} GREATER 4)
+     #TODO: check haveconfig and rpath -> set rpath true
+     #TODO: check Thread, define link command
+     #TODO: more stuff check configure script
+-    execute_process(COMMAND /usr/sbin/sysctl machdep.cpu.extfeatures OUTPUT_VARIABLE SYSCTL_OUTPUT)
+-    if(${SYSCTL_OUTPUT} MATCHES 64)
+-       MESSAGE(STATUS "Found a 64bit system")
+        set(ROOT_ARCHITECTURE macosx64)
+        SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
+        SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -m64")
+@@ -38,28 +24,6 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
+        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
+        SET(CMAKE_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} -m64")
+-    else(${SYSCTL_OUTPUT} MATCHES 64)
+-       MESSAGE(STATUS "Found a 32bit system")
+-       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+-       SET(CMAKE_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} -m32")
+-    endif(${SYSCTL_OUTPUT} MATCHES 64)
+-  endif()
+-
+-  if(MACOSX_VERSION VERSION_GREATER 10.6)
+-    set(MACOSX_SSL_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.7)
+-    set(MACOSX_ODBC_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.8)
+-    set(MACOSX_GLU_DEPRECATED ON)
+-    set(MACOSX_KRB5_DEPRECATED ON)
+-    set(MACOSX_TMPNAM_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.9)
+-    set(MACOSX_LDAP_DEPRECATED ON)
+-  endif()
+ 
+   if (CMAKE_COMPILER_IS_GNUCXX)
+      message(STATUS "Found GNU compiler collection")
+@@ -132,7 +96,7 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+   endif()
+ 
+   #---Set Linker flags----------------------------------------------------------------------
+-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}  -mmacosx-version-min=${MACOSX_VERSION} -Wl,-rpath,@loader_path/../lib")
++  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,@loader_path/../lib")
+ 
+ 
+ else (CMAKE_SYSTEM_NAME MATCHES Darwin)
+diff --git a/config/root-config.in b/config/root-config.in
+--- a/config/root-config.in
++++ b/config/root-config.in
+@@ -391,7 +391,7 @@ macosxicc)
+    ;;
+ macosx64)
+    # MacOS X with gcc (GNU cc v4.x) in 64 bit mode
+-   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
++   macosx_minor=7
+    # cannot find the one linked to libGraf if relocated after built
+    if [ $macosx_minor -le 4 ]; then
+       rootlibs="$rootlibs -lfreetype"
+diff --git a/cint/ROOT/CMakeLists.txt b/cint/ROOT/CMakeLists.txt
+--- a/cint/ROOT/CMakeLists.txt
++++ b/cint/ROOT/CMakeLists.txt
+@@ -232,9 +232,7 @@ foreach(_name ${CINTINCDLLNAMES})
+                        DEPENDS ${HEADER_OUTPUT_PATH}/systypes.h
+                       )
+
+-    if(MACOSX_MINOR GREATER 4)
+       set(_ExtraFlag "-D__DARWIN_UNIX03")
+-    endif()
+
+     add_custom_command(OUTPUT ${OutFileName}
+                        COMMAND cint_tmp -K -w1 -z${_name} -n${OutFileName} -D__MAKECINT__ -DG__MAKECINT ${_ExtraFlag} -c-2 -Z0 ${InFileName} ${AdditionalHeaderFiles} ${CMAKE_BINARY_DIR}/cint/cint/include/sys/types.h ${CMAKE_SOURCE_DIR}/cint/cint/lib/posix/posix.h
\ No newline at end of file
diff --git a/nixpkgs/pkgs/applications/science/misc/sasview/default.nix b/nixpkgs/pkgs/applications/science/misc/sasview/default.nix
new file mode 100644
index 000000000000..bbbe80eb6568
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/sasview/default.nix
@@ -0,0 +1,75 @@
+{ lib, fetchFromGitHub, gcc, python }:
+
+let
+  xhtml2pdf = import ./xhtml2pdf.nix {
+    inherit lib;
+    fetchPypi = python.pkgs.fetchPypi;
+    buildPythonPackage = python.pkgs.buildPythonPackage;
+    html5lib = python.pkgs.html5lib;
+    httplib2 = python.pkgs.httplib2;
+    nose = python.pkgs.nose;
+    pillow = python.pkgs.pillow;
+    pypdf2 = python.pkgs.pypdf2;
+    reportlab = python.pkgs.reportlab;
+  };
+
+in
+
+python.pkgs.buildPythonApplication rec {
+  pname = "sasview";
+  version = "4.2.0";
+
+  checkInputs = with python.pkgs; [
+    pytest
+    unittest-xml-reporting
+  ];
+
+  checkPhase = ''
+    # fix the following error:
+    # imported module 'sas.sascalc.data_util.uncertainty' has this __file__ attribute:
+    #   /build/source/build/lib.linux-x86_64-2.7/sas/sascalc/data_util/uncertainty.py
+    # which is not the same as the test file we want to collect:
+    #   /build/source/dist/tmpbuild/sasview/sas/sascalc/data_util/uncertainty.py
+    rm -r dist/tmpbuild
+
+    HOME=$(mktemp -d) py.test
+  '';
+
+  propagatedBuildInputs = with python.pkgs; [
+    bumps
+    gcc
+    h5py
+    libxslt
+    lxml
+    matplotlib
+    numpy
+    pyparsing
+    periodictable
+    pillow
+    pylint
+    pyopencl
+    reportlab
+    sasmodels
+    scipy
+    six
+    sphinx
+    wxPython
+    xhtml2pdf
+  ];
+
+  src = fetchFromGitHub {
+    owner = "SasView";
+    repo = "sasview";
+    rev = "v${version}";
+    sha256 = "0k3486h46k6406h0vla8h68fd78wh3dcaq5w6f12jh6g4cjxv9qa";
+  };
+
+  patches = [ ./pyparsing-fix.patch ./local_config.patch ];
+
+  meta = with lib; {
+    homepage = "https://www.sasview.org";
+    description = "Fitting and data analysis for small angle scattering data";
+    maintainers = with maintainers; [ rprospero ];
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/sasview/local_config.patch b/nixpkgs/pkgs/applications/science/misc/sasview/local_config.patch
new file mode 100644
index 000000000000..5b6c3436494a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/sasview/local_config.patch
@@ -0,0 +1,22 @@
+diff --git a/src/sas/_config.py b/src/sas/_config.py
+index ece08fd4c..926768593 100644
+--- a/src/sas/_config.py
++++ b/src/sas/_config.py
+@@ -67,8 +67,8 @@ def load_local_config(app_dir):
+         logger.info("GuiManager loaded %s", path)
+         return module
+     except Exception as exc:
+-        logger.critical("Error loading %s: %s", path, exc)
+-        sys.exit()
++        import sas.sasview.local_config
++        return sas.sasview.local_config
+ 
+ def make_custom_config_path(user_dir):
+     """
+@@ -116,4 +116,4 @@ def load_custom_config(path):
+ 
+     from sas.sasview import custom_config
+     logger.info("GuiManager custom_config defaults to sas.sasview.custom_config")
+-    return custom_config
+\ No newline at end of file
++    return custom_config
diff --git a/nixpkgs/pkgs/applications/science/misc/sasview/pyparsing-fix.patch b/nixpkgs/pkgs/applications/science/misc/sasview/pyparsing-fix.patch
new file mode 100644
index 000000000000..c3cd164a899a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/sasview/pyparsing-fix.patch
@@ -0,0 +1,13 @@
+diff --git a/setup.py b/setup.py
+index 866ab7e36..78727b276 100755
+--- a/setup.py
++++ b/setup.py
+@@ -401,7 +401,7 @@ package_data['sas.sasview'] = ['images/*',
+ packages.append("sas.sasview")
+ 
+ required = [
+-    'bumps>=0.7.5.9', 'periodictable>=1.5.0', 'pyparsing>=2.0.0',
++    'bumps>=0.7.5.9', 'periodictable>=1.5.0',
+ 
+     # 'lxml>=2.2.2',
+     'lxml', 'h5py',
diff --git a/nixpkgs/pkgs/applications/science/misc/sasview/xhtml2pdf.nix b/nixpkgs/pkgs/applications/science/misc/sasview/xhtml2pdf.nix
new file mode 100644
index 000000000000..41d15e2f1bab
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/sasview/xhtml2pdf.nix
@@ -0,0 +1,33 @@
+{lib, fetchPypi, buildPythonPackage, html5lib, httplib2, nose, pillow, pypdf2, reportlab}:
+
+let
+  #xhtml2pdf specifically requires version "1.0b10" of html5lib
+  html5 = html5lib.overrideAttrs( oldAttrs: rec {
+    name = "${oldAttrs.pname}-${version}";
+    version = "1.0b10";
+    src = oldAttrs.src.override {
+      inherit version;
+      sha256 = "1yd068a5c00wd0ajq0hqimv7fd82lhrw0w3s01vbhy9bbd6xapqd";
+    };
+  });
+in
+
+buildPythonPackage rec {
+  pname = "xhtml2pdf";
+  version = "0.2.1";
+
+  buildInputs = [html5];
+  propagatedBuildInputs = [httplib2 nose pillow pypdf2 reportlab html5];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1n9r8zdk9gc2x539fq60bhszmd421ipj8g78zmsn3njvma1az9k1";
+  };
+
+  meta = {
+    description = "A pdf converter for the ReportLab Toolkit";
+    homepage = "https://github.com/xhtml2pdf/xhtml2pdf";
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ rprospero ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/simgrid/default.nix b/nixpkgs/pkgs/applications/science/misc/simgrid/default.nix
new file mode 100644
index 000000000000..0ba1cd0d2faf
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/simgrid/default.nix
@@ -0,0 +1,112 @@
+{ stdenv, fetchFromGitLab, cmake, perl, python3, boost, valgrind
+# Optional requirements
+# Lua 5.3 needed and not available now
+#, luaSupport ? false, lua5
+, fortranSupport ? false, gfortran
+, buildDocumentation ? false, transfig, ghostscript, doxygen
+, buildJavaBindings ? false, openjdk
+, modelCheckingSupport ? false, libunwind, libevent, elfutils # Inside elfutils: libelf and libdw
+, debug ? false
+, moreTests ? false
+}:
+
+with stdenv.lib;
+
+let
+  optionOnOff = option: if option then "on" else "off";
+in
+
+stdenv.mkDerivation rec {
+  pname = "simgrid";
+  version = "3.25";
+
+  src = fetchFromGitLab {
+    domain = "framagit.org";
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "019fgryfwpcrkv1f3271v7qxk0mfw2w990vgnk1cqhmr9i1f17gs";
+  };
+
+  nativeBuildInputs = [ cmake perl python3 boost valgrind ]
+      ++ optionals fortranSupport [ gfortran ]
+      ++ optionals buildJavaBindings [ openjdk ]
+      ++ optionals buildDocumentation [ transfig ghostscript doxygen ]
+      ++ optionals modelCheckingSupport [ libunwind libevent elfutils ];
+
+  #buildInputs = optional luaSupport lua5;
+
+  # Make it so that libsimgrid.so will be found when running programs from
+  # the build dir.
+  preConfigure = ''
+    export LD_LIBRARY_PATH="$PWD/build/lib"
+  '';
+
+  # Release mode is not supported in SimGrid
+  cmakeBuildType = "Debug";
+
+  # Disable/Enable functionality
+  # Note: those packages are not packaged in Nixpkgs yet so some options
+  # are disabled:
+  # - papi:   for enable_smpi_papi
+  # - ns3:    for enable_ns3
+  # - lua53:  for enable_lua
+  #
+  # For more information see:
+  # https://simgrid.org/doc/3.22/Installing_SimGrid.html#simgrid-compilation-options)
+  cmakeFlags = [
+    "-Denable_documentation=${optionOnOff buildDocumentation}"
+    "-Denable_java=${optionOnOff buildJavaBindings}"
+    "-Denable_fortran=${optionOnOff fortranSupport}"
+    "-Denable_model-checking=${optionOnOff modelCheckingSupport}"
+    "-Denable_ns3=off"
+    "-Denable_lua=off"
+    "-Denable_lib_in_jar=off"
+    "-Denable_maintainer_mode=off"
+    "-Denable_mallocators=on"
+    "-Denable_debug=on"
+    "-Denable_smpi=on"
+    "-Denable_smpi_ISP_testsuite=${optionOnOff moreTests}"
+    "-Denable_smpi_MPICH3_testsuite=${optionOnOff moreTests}"
+    "-Denable_compile_warnings=${optionOnOff debug}"
+    "-Denable_compile_optimizations=${optionOnOff (!debug)}"
+    "-Denable_lto=${optionOnOff (!debug)}"
+    # "-Denable_lua=${optionOnOff luaSupport}"
+    # "-Denable_smpi_papi=${optionOnOff moreTests}"
+  ];
+
+  makeFlags = optional debug "VERBOSE=1";
+
+  # Some Perl scripts are called to generate test during build which
+  # is before the fixupPhase, so do this manualy here:
+  preBuild = ''
+    patchShebangs ..
+  '';
+
+  doCheck = true;
+
+  # Prevent the execution of tests known to fail.
+  preCheck = ''
+    cat <<EOW >CTestCustom.cmake
+    SET(CTEST_CUSTOM_TESTS_IGNORE smpi-replay-multiple)
+    EOW
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Framework for the simulation of distributed applications";
+    longDescription = ''
+      SimGrid is a toolkit that provides core functionalities for the
+      simulation of distributed applications in heterogeneous distributed
+      environments.  The specific goal of the project is to facilitate
+      research in the area of distributed and parallel application
+      scheduling on distributed computing platforms ranging from simple
+      network of workstations to Computational Grids.
+    '';
+    homepage = "https://simgrid.org/";
+    license = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ mickours mpoquet ];
+    platforms = ["x86_64-linux"];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/snakemake/default.nix b/nixpkgs/pkgs/applications/science/misc/snakemake/default.nix
new file mode 100644
index 000000000000..2b7532a93454
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/snakemake/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, python3Packages }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "snakemake";
+  version = "5.19.3";
+
+  propagatedBuildInputs = with python3Packages; [
+    appdirs
+    ConfigArgParse
+    datrie
+    docutils
+    GitPython
+    jsonschema
+    nbformat
+    psutil
+    pyyaml
+    ratelimiter
+    requests
+    toposort
+    wrapt
+  ];
+
+  src = python3Packages.fetchPypi {
+    inherit pname version;
+    sha256 = "b83f3ef73e25dafcb39b3565030e33fa2f7e80ed70256c535dc7e58ea762305d";
+  };
+
+  doCheck = false; # Tests depend on Google Cloud credentials at ${HOME}/gcloud-service-key.json
+
+  meta = with stdenv.lib; {
+    homepage = "https://snakemake.readthedocs.io";
+    license = licenses.mit;
+    description = "Python-based execution environment for make-like workflows";
+    longDescription = ''
+      Snakemake is a workflow management system that aims to reduce the complexity of
+      creating workflows by providing a fast and comfortable execution environment,
+      together with a clean and readable specification language in Python style. Snakemake
+      workflows are essentially Python scripts extended by declarative code to define
+      rules. Rules describe how to create output files from input files.
+    '';
+    maintainers = with maintainers; [ helkafen renatoGarcia veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/tulip/default.nix b/nixpkgs/pkgs/applications/science/misc/tulip/default.nix
new file mode 100644
index 000000000000..f29cd41169d4
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/tulip/default.nix
@@ -0,0 +1,39 @@
+{ fetchurl, stdenv, libxml2, freetype, libGLU, libGL, glew, qt4
+, cmake, makeWrapper, libjpeg, python }:
+
+let version = "5.2.1"; in
+stdenv.mkDerivation rec {
+  pname = "tulip";
+  inherit version;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/auber/${pname}-${version}_src.tar.gz";
+    sha256 = "0bqmqy6sri87a8xv5xf7ffaq5zin4hiaa13g0l64b84i7yckfwky";
+  };
+
+  buildInputs = [ libxml2 freetype glew libGLU libGL qt4 libjpeg python ];
+
+  nativeBuildInputs = [ cmake makeWrapper ];
+
+  # FIXME: "make check" needs Docbook's DTD 4.4, among other things.
+  doCheck = false;
+
+  meta = {
+    description = "A visualization framework for the analysis and visualization of relational data";
+
+    longDescription =
+      '' Tulip is an information visualization framework dedicated to the
+         analysis and visualization of relational data.  Tulip aims to
+         provide the developer with a complete library, supporting the design
+         of interactive information visualization applications for relational
+         data that can be tailored to the problems he or she is addressing.
+      '';
+
+    homepage = "http://tulip.labri.fr/";
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/misc/vite/default.nix b/nixpkgs/pkgs/applications/science/misc/vite/default.nix
new file mode 100644
index 000000000000..0d749bb9be4f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/misc/vite/default.nix
@@ -0,0 +1,44 @@
+{ fetchsvn, stdenv, cmake, qt4, libGLU, libGL }:
+
+# ViTE 1.1 has several bugs, so use the SVN version.
+let
+  rev = "1543";
+  externals = fetchsvn {
+    url = "svn://scm.gforge.inria.fr/svn/vite/externals";
+    sha256 = "1a422n3dp72v4visq5b1i21cf8sj12903sgg5v2hah3sgk02dnyz";
+    inherit rev;
+  };
+in
+stdenv.mkDerivation {
+  name = "vite-1.2pre${rev}";
+
+  src = fetchsvn {
+    url = "svn://scm.gforge.inria.fr/svn/vite/trunk";
+    sha256 = "02479dv96h29d0w0svp42mjjrxhmv8lkkqp30w7mlx5gr2g0v7lf";
+    inherit rev;
+  };
+
+  preConfigure = ''
+    rm -rv externals
+    ln -sv "${externals}" externals
+  '';
+
+  buildInputs = [ cmake qt4 libGLU libGL ];
+
+  NIX_LDFLAGS = "-lGLU";
+
+  meta = {
+    description = "Visual Trace Explorer (ViTE), a tool to visualize execution traces";
+
+    longDescription = ''
+      ViTE is a trace explorer. It is a tool to visualize execution
+      traces in Pajé or OTF format for debugging and profiling
+      parallel or distributed applications.
+    '';
+
+    homepage = "http://vite.gforge.inria.fr/";
+    license = stdenv.lib.licenses.cecill20;
+    maintainers = with stdenv.lib.maintainers; [ ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}