cmdstan: build from source
This commit is contained in:
parent
7ea4e36ad7
commit
bcb37e4aca
1 changed files with 23 additions and 22 deletions
|
@ -1,25 +1,18 @@
|
||||||
{ lib, stdenv, fetchurl, python3, runtimeShell }:
|
{ lib, stdenv, fetchFromGitHub, stanc, python3, buildPackages, runtimeShell }:
|
||||||
|
|
||||||
let
|
|
||||||
# FIXME: remove conditional on future release
|
|
||||||
version = if stdenv.isx86_64 then "2.31.0" else "2.30.1";
|
|
||||||
# includes stanc binaries needed to build cmdstand
|
|
||||||
srcs = rec {
|
|
||||||
aarch64-linux = fetchurl {
|
|
||||||
url = "https://github.com/stan-dev/cmdstan/releases/download/v${version}/cmdstan-${version}-linux-arm64.tar.gz";
|
|
||||||
sha256 = "sha256-oj/7JHT4LZcRAHiA2KbM6pZbOe6C98Ff//cNsG9DIm8=";
|
|
||||||
};
|
|
||||||
x86_64-darwin = fetchurl {
|
|
||||||
url = "https://github.com/stan-dev/cmdstan/releases/download/v${version}/cmdstan-${version}.tar.gz";
|
|
||||||
sha256 = "sha256-BMqRRWIC/Z7It2qkESJd9L3ycyxvA6NHiWbAvzVMzIQ=";
|
|
||||||
};
|
|
||||||
x86_64-linux = x86_64-darwin;
|
|
||||||
};
|
|
||||||
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "cmdstan";
|
pname = "cmdstan";
|
||||||
inherit version src;
|
version = "2.31.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "stan-dev";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
sha256 = "sha256-Uh/ZhEnbhQwC8xGFjDzH9No3VRgVbHYk2KoC+e3YhJw=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ stanc ];
|
||||||
|
|
||||||
buildFlags = [ "build" ];
|
buildFlags = [ "build" ];
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -38,6 +31,13 @@ stdenv.mkDerivation rec {
|
||||||
src/test/interface/stansummary_test.cpp
|
src/test/interface/stansummary_test.cpp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
|
mkdir -p bin
|
||||||
|
ln -s ${buildPackages.stanc}/bin/stanc bin/stanc
|
||||||
|
'';
|
||||||
|
|
||||||
|
makeFlags = lib.optional stdenv.isDarwin "arch=${stdenv.hostPlatform.darwinArch}";
|
||||||
|
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
./runCmdStanTests.py -j$NIX_BUILD_CORES src/test/interface
|
./runCmdStanTests.py -j$NIX_BUILD_CORES src/test/interface
|
||||||
'';
|
'';
|
||||||
|
@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
|
||||||
# Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference.
|
# Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference.
|
||||||
preFixup = "rm -rf stan";
|
preFixup = "rm -rf stan";
|
||||||
|
|
||||||
meta = {
|
meta = with lib; {
|
||||||
description = "Command-line interface to Stan";
|
description = "Command-line interface to Stan";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
Stan is a probabilistic programming language implementing full Bayesian
|
Stan is a probabilistic programming language implementing full Bayesian
|
||||||
|
@ -66,7 +66,8 @@ stdenv.mkDerivation rec {
|
||||||
likelihood estimation with Optimization (L-BFGS).
|
likelihood estimation with Optimization (L-BFGS).
|
||||||
'';
|
'';
|
||||||
homepage = "https://mc-stan.org/interfaces/cmdstan.html";
|
homepage = "https://mc-stan.org/interfaces/cmdstan.html";
|
||||||
license = lib.licenses.bsd3;
|
license = licenses.bsd3;
|
||||||
platforms = [ "aarch64-linux" "x86_64-darwin" "x86_64-linux" ];
|
maintainers = with maintainers; [ wegank ];
|
||||||
|
platforms = platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue