-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
181 lines (169 loc) · 4.99 KB
/
flake.nix
File metadata and controls
181 lines (169 loc) · 4.99 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
description = "Flake for a R environment";
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
nix2container.url = "github:nlewo/nix2container";
# nix2container.inputs.nixpkgs.follows = "nixpkgs"; # TODO: problem building skopeo
};
outputs =
{
self,
nixpkgs,
flake-utils,
nix2container,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
nix2containerPkgs = nix2container.packages.${system};
imageBuilder = (import ./nix_package/image.nix { inherit nix2containerPkgs pkgs; }).builder;
Rpkgs = pkgs;
R-packages = with Rpkgs.rPackages; [
shiny
shinydashboard
shinycssloaders
shinyjs
shinyvalidate
RSQLite
MASS
digest
plotly
DT
igraph
lubridate
vistime
scrm
GenomicRanges
bsicons
uuid
shinyTree
prettyunits
reactable
shinyWidgets
logger
callr
(pkgs.rPackages.buildRPackage {
name = "rutilstimflutre";
src = pkgs.fetchFromGitHub {
owner = "timflutre";
repo = "rutilstimflutre";
rev = "42660be440687c50169acae592cc32e1a11e4255";
sha256 = "sha256-Au1Izpuht83S4oEhq+1fq4cIrOt+48DbsCoxNvdndi4=";
};
propagatedBuildInputs = with pkgs.rPackages; [
data_table
lme4
Matrix
Rcpp
];
})
];
R-test-packages = with Rpkgs.rPackages; [ testthat ];
R-dev-packages = with Rpkgs.rPackages; [
devtools
languageserver
styler
profvis
microbenchmark
];
in
rec {
devShells.default = pkgs.mkShell {
LOCALE_ARCHIVE =
if "${system}" == "x86_64-linux" then "${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive" else "";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
R_LIBS_USER = "''"; # to not use users' installed R packages
R_ZIPCMD = "${pkgs.zip}/bin/zip";
TEST_PORT = 3000;
PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright.browsers;
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
nativeBuildInputs = [ pkgs.bashInteractive ];
shellHook = ''
npm install --ignore-scripts
export PLANTBREEDGAME_DATA_ROOT=$(realpath ./data);
'';
buildInputs = [
(Rpkgs.rWrapper.override { packages = R-packages ++ R-test-packages ++ R-dev-packages; })
(Rpkgs.rstudioWrapper.override { packages = R-packages ++ R-test-packages ++ R-dev-packages; })
pkgs.pandoc
pkgs.zip
pkgs.nodejs
pkgs.playwright
pkgs.skopeo
pkgs.chromium
];
};
apps = {
default = {
type = "app";
program = nixpkgs.lib.getExe (
pkgs.writeShellApplication {
name = "PlantBreedGame";
text = ''
${nixpkgs.lib.getExe (packages.plantBreedGame-dev)} --port 3000
'';
}
);
};
ui_tests = {
type = "app";
program = nixpkgs.lib.getExe (
pkgs.writeShellApplication {
name = "PlantBreedGame-test_ui";
text = ''
make ui_tests
'';
}
);
};
unit_tests = {
type = "app";
program = nixpkgs.lib.getExe (
pkgs.writeShellApplication {
name = "PlantBreedGame-unit_tests";
text = ''
make unit_tests
'';
}
);
};
initialise-data = {
type = "app";
program = nixpkgs.lib.getExe (
pkgs.writeShellApplication {
name = "PlantBreedGame-unit_tests";
text = ''
make data
'';
}
);
};
};
packages.plantBreedGame = pkgs.callPackage ./nix_package/default.nix {
inherit pkgs;
R_deps = R-packages;
tests_R_deps = R-test-packages;
src = pkgs.lib.sources.cleanSource ./.;
};
packages.default = packages.plantBreedGame;
packages.plantBreedGame-dev = (
packages.plantBreedGame.overrideAttrs (oldAttrs: {
doCheck = false;
})
);
images = {
latest =
let
in
(imageBuilder {
imageName = "plantBreedGame";
plantBreedGame = packages.plantBreedGame;
tag = "latest";
});
};
}
);
}