Skip to content

Commit c223477

Browse files
committed
nix-shell which can compile site
1 parent 145b254 commit c223477

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

shell.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# To enable this shell run nix-shell from the command line and you will be
2+
# dropped into a shell with the necessary packages installed to compile this
3+
# site.
4+
#
5+
# NOTE If you encounter errors with the stringi library, the stackoverflow
6+
# answer https://stackoverflow.com/a/35094828/15291819 provides a solution that
7+
# seems to work, you just need to install stringi with the following command
8+
#
9+
# > install.packages("stringi",
10+
# repos="http://cran.rstudio.com/",
11+
# dependencies=TRUE)
12+
#
13+
14+
let
15+
commitHash = "78dc359abf8217da2499a6da0fcf624b139d7ac3";
16+
tarballUrl = "https://github.com/NixOS/nixpkgs/archive/${commitHash}.tar.gz";
17+
pkgs = import (fetchTarball tarballUrl) {};
18+
stdenv = pkgs.stdenv;
19+
in with pkgs; {
20+
myProject = stdenv.mkDerivation {
21+
name = "example-r-env";
22+
version = "1";
23+
src = if pkgs.lib.inNixShell then null else nix;
24+
25+
buildInputs = with rPackages; [
26+
R
27+
dplyr
28+
purrr
29+
magrittr
30+
ggplot2
31+
stringr
32+
pandoc
33+
];
34+
shellHook = ''
35+
printf "\n\nWelcome to a reproducible R shell :)\n\n"
36+
'';
37+
};
38+
}

0 commit comments

Comments
 (0)