nixpkgs/pkgs/development/compilers/cmdstan/default.nix
Jörg Thalheim dadc7eb329
treewide: use runtimeShell instead of stdenv.shell whenever possible
Whenever we create scripts that are installed to $out, we must use runtimeShell
in order to get the shell that can be executed on the machine we create the
package for. This is relevant for cross-compiling. The only use case for
stdenv.shell are scripts that are executed as part of the build system.
Usages in checkPhase are borderline however to decrease the likelyhood
of people copying the wrong examples, I decided to use runtimeShell as well.
2019-02-26 14:10:49 +00:00

43 lines
1.3 KiB
Nix

{ stdenv, fetchurl, python, runtimeShell }:
stdenv.mkDerivation rec {
name = "cmdstan-2.17.1";
src = fetchurl {
url = "https://github.com/stan-dev/cmdstan/releases/download/v2.17.1/cmdstan-2.17.1.tar.gz";
sha256 = "1vq1cnrkvrvbfl40j6ajc60jdrjcxag1fi6kff5pqmadfdz9564j";
};
buildFlags = "build";
enableParallelBuilding = true;
doCheck = true;
checkInputs = [ python ];
checkPhase = "python ./runCmdStanTests.py src/test/interface"; # see #5368
installPhase = ''
mkdir -p $out/opt $out/bin
cp -r . $out/opt/cmdstan
ln -s $out/opt/cmdstan/bin/stanc $out/bin/stanc
ln -s $out/opt/cmdstan/bin/stansummary $out/bin/stansummary
cat > $out/bin/stan <<EOF
#!${runtimeShell}
make -C $out/opt/cmdstan "\$(realpath "\$1")"
EOF
chmod a+x $out/bin/stan
'';
meta = {
description = "Command-line interface to Stan";
longDescription = ''
Stan is a probabilistic programming language implementing full Bayesian
statistical inference with MCMC sampling (NUTS, HMC), approximate Bayesian
inference with Variational inference (ADVI) and penalized maximum
likelihood estimation with Optimization (L-BFGS).
'';
homepage = http://mc-stan.org/interfaces/cmdstan.html;
license = stdenv.lib.licenses.bsd3;
platforms = stdenv.lib.platforms.all;
};
}