|
1 | | -/* This file defines the composition for CRAN (R) packages. */ |
| 1 | +/* This file defines the composition for R packages. */ |
| 2 | + |
| 3 | +let |
| 4 | + importJSON = f: builtins.fromJSON (builtins.readFile f); |
| 5 | + |
| 6 | + biocPackagesGenerated = importJSON ./bioc-packages.json; |
| 7 | + biocAnnotationPackagesGenerated = importJSON ./bioc-annotation-packages.json; |
| 8 | + biocExperimentPackagesGenerated = importJSON ./bioc-experiment-packages.json; |
| 9 | + cranPackagesGenerated = importJSON ./cran-packages.json; |
| 10 | +in |
2 | 11 |
|
3 | 12 | { R, pkgs, overrides }: |
4 | 13 |
|
|
46 | 55 | # from the name, version, sha256, and optional per-package arguments above |
47 | 56 | # |
48 | 57 | deriveBioc = mkDerive { |
49 | | - mkHomepage = {name, biocVersion, ...}: "https://bioconductor.org/packages/${biocVersion}/bioc/html/${name}.html"; |
| 58 | + mkHomepage = {name, biocVersion}: "https://bioconductor.org/packages/${biocVersion}/bioc/html/${name}.html"; |
50 | 59 | mkUrls = {name, version, biocVersion}: [ |
51 | 60 | "mirror://bioc/${biocVersion}/bioc/src/contrib/${name}_${version}.tar.gz" |
52 | 61 | "mirror://bioc/${biocVersion}/bioc/src/contrib/Archive/${name}/${name}_${version}.tar.gz" |
|
68 | 77 | hydraPlatforms = []; |
69 | 78 | }; |
70 | 79 | deriveCran = mkDerive { |
71 | | - mkHomepage = {name, ...}: "https://cran.r-project.org/web/packages/${name}/"; |
| 80 | + mkHomepage = {name}: "https://cran.r-project.org/web/packages/${name}/"; |
72 | 81 | mkUrls = {name, version}: [ |
73 | 82 | "mirror://cran/${name}_${version}.tar.gz" |
74 | 83 | "mirror://cran/Archive/${name}/${name}_${version}.tar.gz" |
@@ -287,10 +296,18 @@ let |
287 | 296 | # packages in `_self` may depends on overridden packages. |
288 | 297 | self = (defaultOverrides _self self) // overrides; |
289 | 298 | _self = { inherit buildRPackage; } // |
290 | | - import ./bioc-packages.nix { inherit self; derive = deriveBioc; } // |
291 | | - import ./bioc-annotation-packages.nix { inherit self; derive = deriveBiocAnn; } // |
292 | | - import ./bioc-experiment-packages.nix { inherit self; derive = deriveBiocExp; } // |
293 | | - import ./cran-packages.nix { inherit self; derive = deriveCran; }; |
| 299 | + mkPackageSet deriveBioc biocPackagesGenerated // |
| 300 | + mkPackageSet deriveBiocAnn biocAnnotationPackagesGenerated // |
| 301 | + mkPackageSet deriveBiocExp biocExperimentPackagesGenerated // |
| 302 | + mkPackageSet deriveCran cranPackagesGenerated; |
| 303 | + |
| 304 | + # Takes in a generated JSON file's imported contents |
| 305 | + # and transforms it by swapping each element of the depends array with the dependency's derivation |
| 306 | + # and passing this new object to the provided derive function |
| 307 | + mkPackageSet = derive: packagesJSON: lib.mapAttrs ( |
| 308 | + k: v: derive packagesJSON.extraArgs (v // { depends = lib.map (name: builtins.getAttr name self) v.depends; }) |
| 309 | + ) packagesJSON.packages; |
| 310 | + |
294 | 311 |
|
295 | 312 | # tweaks for the individual packages and "in self" follow |
296 | 313 |
|
|
0 commit comments