cran-packages: combined packages definition files further
This commit is contained in:
parent
916e36940b
commit
2d3dd68d27
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,189 @@
|
||||
stdenv: pkgs:
|
||||
{
|
||||
/* This file defines the composition for CRAN (R) packages. */
|
||||
|
||||
{ pkgs, overrides }:
|
||||
|
||||
let
|
||||
inherit (pkgs) R fetchurl stdenv lib xvfb_run utillinux;
|
||||
|
||||
buildRPackage = import ./generic-builder.nix { inherit R xvfb_run utillinux ; };
|
||||
|
||||
# Package template
|
||||
#
|
||||
# some packages, e.g. cncaGUI, require X running while installation,
|
||||
# so that we use xvfb-run if requireX is true.
|
||||
derive = lib.makeOverridable ({
|
||||
name, version, sha256,
|
||||
depends ? [],
|
||||
doCheck ? true,
|
||||
requireX ? false,
|
||||
broken ? false,
|
||||
hydraPlatforms ? R.meta.hydraPlatforms
|
||||
}: buildRPackage {
|
||||
name = "${name}-${version}";
|
||||
src = fetchurl {
|
||||
urls = [
|
||||
"mirror://cran/src/contrib/${name}_${version}.tar.gz"
|
||||
"mirror://cran/src/contrib/Archive/${name}/${name}_${version}.tar.gz"
|
||||
];
|
||||
inherit sha256;
|
||||
};
|
||||
inherit doCheck requireX;
|
||||
propagatedBuildInputs = depends;
|
||||
nativeBuildInputs = depends;
|
||||
meta.homepage = "http://cran.r-project.org/web/packages/${name}/";
|
||||
meta.hydraPlatforms = hydraPlatforms;
|
||||
meta.broken = broken;
|
||||
});
|
||||
|
||||
# Overrides package definitions with nativeBuildInputs.
|
||||
# For example,
|
||||
#
|
||||
# overrideNativeBuildInputs {
|
||||
# foo = [ pkgs.bar ]
|
||||
# } old
|
||||
#
|
||||
# results in
|
||||
#
|
||||
# {
|
||||
# foo = old.foo.overrideDerivation (attrs: {
|
||||
# nativeBuildInputs = attrs.nativeBuildInputs ++ [ pkgs.bar ];
|
||||
# });
|
||||
# }
|
||||
overrideNativeBuildInputs = overrides: old:
|
||||
let
|
||||
attrNames = builtins.attrNames overrides;
|
||||
nameValuePairs = map (name: rec {
|
||||
inherit name;
|
||||
nativeBuildInputs = builtins.getAttr name overrides;
|
||||
value = (builtins.getAttr name old).overrideDerivation (attrs: {
|
||||
nativeBuildInputs = attrs.nativeBuildInputs ++ nativeBuildInputs;
|
||||
});
|
||||
}) attrNames;
|
||||
in
|
||||
builtins.listToAttrs nameValuePairs;
|
||||
|
||||
# Overrides package definitions with buildInputs.
|
||||
# For example,
|
||||
#
|
||||
# overrideBuildInputs {
|
||||
# foo = [ pkgs.bar ]
|
||||
# } old
|
||||
#
|
||||
# results in
|
||||
#
|
||||
# {
|
||||
# foo = old.foo.overrideDerivation (attrs: {
|
||||
# buildInputs = attrs.buildInputs ++ [ pkgs.bar ];
|
||||
# });
|
||||
# }
|
||||
overrideBuildInputs = overrides: old:
|
||||
let
|
||||
attrNames = builtins.attrNames overrides;
|
||||
nameValuePairs = map (name: rec {
|
||||
inherit name;
|
||||
buildInputs = builtins.getAttr name overrides;
|
||||
value = (builtins.getAttr name old).overrideDerivation (attrs: {
|
||||
buildInputs = attrs.buildInputs ++ buildInputs;
|
||||
});
|
||||
}) attrNames;
|
||||
in
|
||||
builtins.listToAttrs nameValuePairs;
|
||||
|
||||
# Overrides package definition requiring X running to install.
|
||||
# For example,
|
||||
#
|
||||
# overrideRequireX [
|
||||
# "foo"
|
||||
# ] old
|
||||
#
|
||||
# results in
|
||||
#
|
||||
# {
|
||||
# foo = old.foo.override {
|
||||
# requireX = true;
|
||||
# };
|
||||
# }
|
||||
overrideRequireX = packageNames: old:
|
||||
let
|
||||
nameValuePairs = map (name: {
|
||||
inherit name;
|
||||
value = (builtins.getAttr name old).override {
|
||||
requireX = true;
|
||||
};
|
||||
}) packageNames;
|
||||
in
|
||||
builtins.listToAttrs nameValuePairs;
|
||||
|
||||
# Overrides package definition to skip check.
|
||||
# For example,
|
||||
#
|
||||
# overrideSkipCheck [
|
||||
# "foo"
|
||||
# ] old
|
||||
#
|
||||
# results in
|
||||
#
|
||||
# {
|
||||
# foo = old.foo.override {
|
||||
# doCheck = false;
|
||||
# };
|
||||
# }
|
||||
overrideSkipCheck = packageNames: old:
|
||||
let
|
||||
nameValuePairs = map (name: {
|
||||
inherit name;
|
||||
value = (builtins.getAttr name old).override {
|
||||
doCheck = false;
|
||||
};
|
||||
}) packageNames;
|
||||
in
|
||||
builtins.listToAttrs nameValuePairs;
|
||||
|
||||
# Overrides package definition to mark it broken.
|
||||
# For example,
|
||||
#
|
||||
# overrideBroken [
|
||||
# "foo"
|
||||
# ] old
|
||||
#
|
||||
# results in
|
||||
#
|
||||
# {
|
||||
# foo = old.foo.override {
|
||||
# broken = true;
|
||||
# };
|
||||
# }
|
||||
overrideBroken = packageNames: old:
|
||||
let
|
||||
nameValuePairs = map (name: {
|
||||
inherit name;
|
||||
value = (builtins.getAttr name old).override {
|
||||
broken = true;
|
||||
};
|
||||
}) packageNames;
|
||||
in
|
||||
builtins.listToAttrs nameValuePairs;
|
||||
|
||||
defaultOverrides = old: new:
|
||||
let old0 = old; in
|
||||
let
|
||||
old1 = old0 // (overrideRequireX packagesRequireingX old0);
|
||||
old2 = old1 // (overrideSkipCheck packagesToSkipCheck old1);
|
||||
old3 = old2 // (overrideNativeBuildInputs packagesWithNativeBuildInputs old2);
|
||||
old4 = old3 // (overrideBuildInputs packagesWithBuildInputs old3);
|
||||
old5 = old4 // (overrideBroken brokenPackages old4);
|
||||
old = old5;
|
||||
in old // (otherOverrides old new);
|
||||
|
||||
# Recursive override pattern.
|
||||
# `_self` is a collection of packages;
|
||||
# `self` is `_self` with overridden packages;
|
||||
# packages in `_self` may depends on overridden packages.
|
||||
self = (defaultOverrides _self self) // overrides;
|
||||
_self = import ./sources.nix { inherit self derive; };
|
||||
|
||||
# tweaks for the individual packages and "in self" follow
|
||||
|
||||
packagesWithNativeBuildInputs = {
|
||||
# sort -t '=' -k 2
|
||||
RAppArmor = [ pkgs.apparmor ];
|
||||
@ -873,5 +1057,5 @@ stdenv: pkgs:
|
||||
];
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
in
|
||||
self
|
@ -31,10 +31,10 @@ knownPackages <- unique(pkgs$Package)
|
||||
|
||||
nix <- apply(pkgs, 1, function(p) formatPackage(p[1], p[2], p[18], p[4], p[5], p[6], knownPackages))
|
||||
|
||||
cat("# This file is generated from generate_sources.R. DO NOT EDIT.\n")
|
||||
cat("# This file is generated from generate-cran-packages.R. DO NOT EDIT.\n")
|
||||
cat("# Execute the following command to update the file.\n")
|
||||
cat("#\n")
|
||||
cat("# Rscript generate_sources.R > sources.nix\n")
|
||||
cat("# Rscript generate-cran-packages.R > cran-packages.nix\n")
|
||||
cat("\n")
|
||||
cat("{ self, derive }: with self; {\n")
|
||||
cat(paste(nix, collapse="\n"), "\n")
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user