-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix_generate-r-default.patch
83 lines (76 loc) · 3.78 KB
/
fix_generate-r-default.patch
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
diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix
index d17cf9941491..824c1d5fd1b4 100644
--- a/pkgs/development/r-modules/default.nix
+++ b/pkgs/development/r-modules/default.nix
@@ -1,13 +1,4 @@
-/* This file defines the composition for R packages. */
-
-let
- importJSON = f: builtins.fromJSON (builtins.readFile f);
-
- biocPackagesGenerated = importJSON ./bioc-packages.json;
- biocAnnotationPackagesGenerated = importJSON ./bioc-annotation-packages.json;
- biocExperimentPackagesGenerated = importJSON ./bioc-experiment-packages.json;
- cranPackagesGenerated = importJSON ./cran-packages.json;
-in
+/* This file defines the composition for CRAN (R) packages. */
{ R, pkgs, overrides }:
@@ -55,7 +46,7 @@ let
# from the name, version, sha256, and optional per-package arguments above
#
deriveBioc = mkDerive {
- mkHomepage = {name, biocVersion}: "https://bioconductor.org/packages/${biocVersion}/bioc/html/${name}.html";
+ mkHomepage = {name, biocVersion, ...}: "https://bioconductor.org/packages/${biocVersion}/bioc/html/${name}.html";
mkUrls = {name, version, biocVersion}: [
"mirror://bioc/${biocVersion}/bioc/src/contrib/${name}_${version}.tar.gz"
"mirror://bioc/${biocVersion}/bioc/src/contrib/Archive/${name}/${name}_${version}.tar.gz"
@@ -77,7 +68,7 @@ let
hydraPlatforms = [];
};
deriveCran = mkDerive {
- mkHomepage = {name}: "https://cran.r-project.org/web/packages/${name}/";
+ mkHomepage = {name, ...}: "https://cran.r-project.org/web/packages/${name}/";
mkUrls = {name, version}: [
"mirror://cran/${name}_${version}.tar.gz"
"mirror://cran/Archive/${name}/${name}_${version}.tar.gz"
@@ -296,18 +287,10 @@ let
# packages in `_self` may depends on overridden packages.
self = (defaultOverrides _self self) // overrides;
_self = { inherit buildRPackage; } //
- mkPackageSet deriveBioc biocPackagesGenerated //
- mkPackageSet deriveBiocAnn biocAnnotationPackagesGenerated //
- mkPackageSet deriveBiocExp biocExperimentPackagesGenerated //
- mkPackageSet deriveCran cranPackagesGenerated;
-
- # Takes in a generated JSON file's imported contents
- # and transforms it by swapping each element of the depends array with the dependency's derivation
- # and passing this new object to the provided derive function
- mkPackageSet = derive: packagesJSON: lib.mapAttrs (
- k: v: derive packagesJSON.extraArgs (v // { depends = lib.map (name: builtins.getAttr name self) v.depends; })
- ) packagesJSON.packages;
-
+ import ./bioc-packages.nix { inherit self; derive = deriveBioc; } //
+ import ./bioc-annotation-packages.nix { inherit self; derive = deriveBiocAnn; } //
+ import ./bioc-experiment-packages.nix { inherit self; derive = deriveBiocExp; } //
+ import ./cran-packages.nix { inherit self; derive = deriveCran; };
# tweaks for the individual packages and "in self" follow
diff --git a/pkgs/development/r-modules/generate-r-packages.R b/pkgs/development/r-modules/generate-r-packages.R
index 8d34edc99781..85a6c33f290f 100644
--- a/pkgs/development/r-modules/generate-r-packages.R
+++ b/pkgs/development/r-modules/generate-r-packages.R
@@ -2,7 +2,7 @@
library(data.table)
library(parallel)
library(BiocManager)
-cl <- makeCluster(10)
+cl <- makeCluster(4)
biocVersion <- BiocManager:::.version_map()
biocVersion <- biocVersion[biocVersion$R == getRversion()[, 1:2],c("Bioc", "BiocStatus")]
@@ -54,7 +54,8 @@ nixPrefetch <- function(name, version) {
}
escapeName <- function(name) {
- switch(name, "import" = "r_import", "assert" = "r_assert", name)
+ name <- gsub("\\bimport\\b", "r_import", name)
+ gsub("\\bassert\\b", "r_assert", name)
}
formatPackage <- function(name, version, sha256, depends, imports, linkingTo) {