2019-02-26 11:45:54 +00:00
|
|
|
{ stdenv, fetchurl, python, runtimeShell }:
|
2015-12-11 12:35:17 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-12-26 17:44:13 +00:00
|
|
|
name = "cmdstan-2.17.1";
|
2015-12-11 12:35:17 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-12-26 17:44:13 +00:00
|
|
|
url = "https://github.com/stan-dev/cmdstan/releases/download/v2.17.1/cmdstan-2.17.1.tar.gz";
|
|
|
|
sha256 = "1vq1cnrkvrvbfl40j6ajc60jdrjcxag1fi6kff5pqmadfdz9564j";
|
2015-12-11 12:35:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildFlags = "build";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
2018-08-08 19:26:16 +01:00
|
|
|
checkInputs = [ python ];
|
|
|
|
checkPhase = "python ./runCmdStanTests.py src/test/interface"; # see #5368
|
2015-12-11 12:35:17 +00:00
|
|
|
|
|
|
|
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
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2015-12-11 12:35:17 +00:00
|
|
|
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;
|
2017-12-26 17:44:13 +00:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2015-12-11 12:35:17 +00:00
|
|
|
};
|
|
|
|
}
|