2021-03-20 04:20:00 +00:00
|
|
|
{ lib, stdenv, fetchurl, python3, runtimeShell }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-23 08:02:39 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cmdstan";
|
|
|
|
version = "2.17.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-23 08:02:39 +00:00
|
|
|
url = "https://github.com/stan-dev/cmdstan/releases/download/v${version}/cmdstan-${version}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "1vq1cnrkvrvbfl40j6ajc60jdrjcxag1fi6kff5pqmadfdz9564j";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildFlags = [ "build" ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
2021-03-20 04:20:00 +00:00
|
|
|
checkInputs = [ python3 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
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 = "https://mc-stan.org/interfaces/cmdstan.html";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
platforms = lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|