-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
156 lines (145 loc) · 4.31 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
description = "Flake for a R environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
vegan_withoutX = pkgs.rPackages.vegan.override { requireX = false; };
vcfR_deps = with pkgs.rPackages; [
ape
dplyr
magrittr
memuse
pinfsc50
Rcpp
stringr
tibble
viridisLite
vegan_withoutX
];
vcfR_withoutX = pkgs.rPackages.vcfR.overrideAttrs (oldAttrs: {
propagatedBuildInputs = vcfR_deps;
nativeBuildInputs = vcfR_deps;
});
R-packages = with pkgs.rPackages; [
argparse
R6
digest
ellipse
gaston
jsonlite
manhattanly
networkD3
qqman
plotly
vcfR_withoutX
pandoc
Rd2md
roxygen2
sommer
caret
RAINBOWR
(pkgs.rPackages.buildRPackage {
name = "breedSimulatR";
src = pkgs.fetchFromGitHub {
owner = "ut-biomet";
repo = "breedSimulatR";
rev = "21fc8eb7f2e83f685a3eb99ca4bc611dee652ddd";
sha256 = "sha256-JZvjTqlj4LK3tvLrrb2oVBgwTKU0Nntur6He2tQveCc=";
};
propagatedBuildInputs = with pkgs.rPackages; [
data_table
R6
vcfR_withoutX
];
nativeBuildInputs = with pkgs.rPackages; [
data_table
R6
vcfR_withoutX
];
})
# developement packages
testthat
AGHmatrix
languageserver
styler
];
in
rec {
packages.r-geno-tools-engine = pkgs.callPackage ./nix_pkgs/default.nix { inherit pkgs; };
packages.default = packages.r-geno-tools-engine;
devShells.default = pkgs.mkShell {
LOCALE_ARCHIVE =
if "${system}" == "x86_64-linux" then "${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive" else "";
R_LIBS_USER = "''"; # to no use users' installed R packages
R_PROFILE_USER = "''"; # to disable`.Rprofile` files (eg. when the project already use `renv`)
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs =
[
(pkgs.rWrapper.override { packages = R-packages; })
pkgs.pandoc
pkgs.python3
((pkgs.callPackage ./nix_pkgs/default.nix { inherit pkgs; }).overrideAttrs (oldAttrs: {
doCheck = false;
}))
]
++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
(pkgs.rstudioWrapper.override { packages = R-packages; })
];
};
apps = {
testsRepo =
let
testsRepo = pkgs.writeShellApplication {
name = "testsRepo";
text = ''
echo "simple unit tests:"
Rscript --vanilla ${./tests/testthat.R}
'';
};
in
{
type = "app";
program = "${testsRepo}/bin/testsRepo";
};
writeDoc =
let
writeDoc = pkgs.writeShellApplication {
name = "writeDoc";
text = ''
Rscript --vanilla -e "source('tools/tools.R'); writeDoc()"
'';
};
in
{
type = "app";
program = "${writeDoc}/bin/writeDoc";
};
createResultExample =
let
createResultExample = pkgs.writeShellApplication {
name = "createResultExample";
text = ''
Rscript --vanilla -e "source('tools/tools.R'); createResultExample()"
'';
};
in
{
type = "app";
program = "${createResultExample}/bin/createResultExample";
};
};
}
);
}