generated from carpentries/workbench-template-md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
65 lines (62 loc) · 1.48 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
description = "R build environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEnv;
pythonEnv = mkPoetryEnv {
python = pkgs.python311;
preferWheels = true;
projectDir = ./.;
};
R-dev = pkgs.rWrapper.override {
packages = with pkgs.rPackages; [
languageserver
systemfonts
textshaping
httr
ragg
httr2
credentials
openssl
curl
httpuv
pkgdown
gh
gert
usethis
servr
xslt
# sandpaper
];
};
in {
devShell = with pkgs; mkShellNoCC {
name = "R";
buildInputs = with pkgs; [
R-dev
pythonEnv
pandoc
pkg-config
readline
python311
poetry
];
# If for some reason you need to install
# packages manually
shellHook = ''
mkdir -p "$(pwd)/_libs"
export R_LIBS_USER="$(pwd)/_libs"
'';
};
});
}