Skip to content

Instantly share code, notes, and snippets.

@cfhammill
Created November 21, 2019 21:46
Show Gist options
  • Save cfhammill/cc69bfc22e931f4d6bd2beb98813569b to your computer and use it in GitHub Desktop.
Save cfhammill/cc69bfc22e931f4d6bd2beb98813569b to your computer and use it in GitHub Desktop.
Nix-shell comlete with INLA
{ pkgs ? import <nixpkgs> {} }:
let
inlaDeps = with pkgs.rPackages;
[ Matrix
sp
Deriv
devtools
doParallel
fields
foreach
graph
gridExtra
HKprocess
knitr
markdown
MatrixModels
matrixStats
mvtnorm
numDeriv
orthopolynom
pixmap
rgdal
rgl
Rgraphviz
rmarkdown
sn
splancs
spdep
shiny
];
#inla_bin = fetchTarball {url = "https://inla.r-inla-download.org/Linux-builds/Ubuntu-18.04.3%20LTS%20(Bionic%20Beaver)/Version_19.09.03/64bit.tgz"; sha256 = "1cnv3z5w1n0lk2gani4xwf00h2g1b9z3gxrbpn4fn671kwck48i2";};
inla = pkgs.rPackages.buildRPackage {
name = "inla";
src = pkgs.fetchurl
{url = "https://inla.r-inla-download.org/R/testing/src/contrib/INLA_19.07.27.tar.gz";
sha256 = "451f624571f63212be4ab188a5df1573a286ab9409d86658d47b3f3d3a3dc70f";};
nativeBuildInputs = inlaDeps;
propagatedBuildInputs = inlaDeps;
postInstall = ''
for file in $out/library/INLA/bin/linux/64bit/inla; do
chmod +rwx $file
patchelf --set-interpreter ${pkgs.stdenv.glibc}/lib/ld-linux-x86-64.so.2 $file
patchelf --force-rpath --set-rpath $out/library/INLA/bin/linux/64bit $file
done
for file in $out/library/INLA/bin/linux/64bit/*.so*; do
chmod +rwx $file
patchelf --force-rpath --set-rpath $out/library/INLA/bin/linux/64bit $file
done
'';
};
in
with pkgs;
mkShell {
buildInputs = [ git emacs gcc pkgconfig
proj R gfortran gsl zlib.dev
suitesparse
] ++
(with rPackages;
[inla
rmarkdown
tidyverse
rstanarm
brms
]) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment