2014-11-21 13:23:36 +00:00
|
|
|
/* This file defines the composition for CRAN (R) packages. */
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-05-04 19:51:14 +01:00
|
|
|
{ pkgs, overrides }:
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-05-04 19:51:14 +01:00
|
|
|
let
|
2014-11-21 13:23:36 +00:00
|
|
|
inherit (pkgs) R fetchurl stdenv lib xvfb_run utillinux;
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
buildRPackage = import ./generic-builder.nix { inherit R xvfb_run utillinux ; };
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
# Package template
|
|
|
|
#
|
|
|
|
# some packages, e.g. cncaGUI, require X running while installation,
|
|
|
|
# so that we use xvfb-run if requireX is true.
|
2014-11-24 05:45:49 +00:00
|
|
|
derive = lib.makeOverridable ({ name, version, sha256, depends ? [], skipTest ? false, requireX ? false, hydraPlatforms ? R.meta.hydraPlatforms }: buildRPackage {
|
2014-05-04 19:51:14 +01:00
|
|
|
name = "${name}-${version}";
|
2013-09-20 00:26:07 +01:00
|
|
|
src = fetchurl {
|
2014-07-08 02:02:05 +01:00
|
|
|
urls = [
|
|
|
|
"mirror://cran/src/contrib/${name}_${version}.tar.gz"
|
|
|
|
"mirror://cran/src/contrib/Archive/${name}/${name}_${version}.tar.gz"
|
|
|
|
];
|
2014-05-04 19:51:14 +01:00
|
|
|
inherit sha256;
|
2013-09-20 00:26:07 +01:00
|
|
|
};
|
2014-11-21 13:23:36 +00:00
|
|
|
inherit skipTest requireX;
|
2014-05-04 19:51:14 +01:00
|
|
|
propagatedBuildInputs = depends;
|
2014-11-21 13:23:36 +00:00
|
|
|
nativeBuildInputs = depends;
|
2014-05-04 23:33:20 +01:00
|
|
|
meta.homepage = "http://cran.r-project.org/web/packages/${name}/";
|
2014-11-24 05:45:49 +00:00
|
|
|
meta.hydraPlatforms = hydraPlatforms;
|
2014-11-21 13:23:36 +00:00
|
|
|
});
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
# Overrides package definitions with nativeBuildInputs.
|
|
|
|
# For example,
|
|
|
|
#
|
|
|
|
# overrideNativeBuildInputs {
|
|
|
|
# foo = [ pkgs.bar ]
|
|
|
|
# } old
|
|
|
|
#
|
|
|
|
# results in
|
|
|
|
#
|
|
|
|
# {
|
2014-11-24 05:45:49 +00:00
|
|
|
# foo = old.foo.overrideDerivation (attrs: {
|
2014-11-21 13:23:36 +00:00
|
|
|
# nativeBuildInputs = attrs.nativeBuildInputs ++ [ pkgs.bar ];
|
|
|
|
# });
|
|
|
|
# }
|
|
|
|
overrideNativeBuildInputs = overrides: old:
|
|
|
|
let
|
|
|
|
attrNames = builtins.attrNames overrides;
|
|
|
|
nameValuePairs = map (name: rec {
|
|
|
|
inherit name;
|
|
|
|
nativeBuildInputs = builtins.getAttr name overrides;
|
2014-11-24 05:45:49 +00:00
|
|
|
value = (builtins.getAttr name old).overrideDerivation (attrs: {
|
2014-11-21 13:23:36 +00:00
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs ++ nativeBuildInputs;
|
|
|
|
});
|
|
|
|
}) attrNames;
|
|
|
|
in
|
|
|
|
builtins.listToAttrs nameValuePairs;
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
# Overrides package definitions with buildInputs.
|
|
|
|
# For example,
|
|
|
|
#
|
|
|
|
# overrideBuildInputs {
|
|
|
|
# foo = [ pkgs.bar ]
|
|
|
|
# } old
|
|
|
|
#
|
|
|
|
# results in
|
|
|
|
#
|
|
|
|
# {
|
2014-11-24 05:45:49 +00:00
|
|
|
# foo = old.foo.overrideDerivation (attrs: {
|
2014-11-21 13:23:36 +00:00
|
|
|
# buildInputs = attrs.buildInputs ++ [ pkgs.bar ];
|
|
|
|
# });
|
|
|
|
# }
|
|
|
|
overrideBuildInputs = overrides: old:
|
|
|
|
let
|
|
|
|
attrNames = builtins.attrNames overrides;
|
|
|
|
nameValuePairs = map (name: rec {
|
|
|
|
inherit name;
|
|
|
|
buildInputs = builtins.getAttr name overrides;
|
2014-11-24 05:45:49 +00:00
|
|
|
value = (builtins.getAttr name old).overrideDerivation (attrs: {
|
2014-11-21 13:23:36 +00:00
|
|
|
buildInputs = attrs.buildInputs ++ buildInputs;
|
|
|
|
});
|
|
|
|
}) attrNames;
|
|
|
|
in
|
|
|
|
builtins.listToAttrs nameValuePairs;
|
2013-09-20 00:26:07 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
# 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;
|
2014-05-07 11:29:25 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
# Overrides package definition to skip tests.
|
|
|
|
# For example,
|
|
|
|
#
|
|
|
|
# overrideSkipTests [
|
|
|
|
# "foo"
|
|
|
|
# ] old
|
|
|
|
#
|
|
|
|
# results in
|
|
|
|
#
|
|
|
|
# {
|
|
|
|
# foo = old.foo.override {
|
|
|
|
# skipTest = true;
|
|
|
|
# };
|
|
|
|
# }
|
|
|
|
overrideSkipTests = packageNames: old:
|
|
|
|
let
|
|
|
|
nameValuePairs = map (name: {
|
|
|
|
inherit name;
|
|
|
|
value = (builtins.getAttr name old).override {
|
|
|
|
skipTest = true;
|
|
|
|
};
|
|
|
|
}) packageNames;
|
|
|
|
in
|
|
|
|
builtins.listToAttrs nameValuePairs;
|
|
|
|
|
2014-11-24 04:38:06 +00:00
|
|
|
packagesWithNativeBuildInputs = import ./packages-with-native-build-inputs.nix pkgs;
|
|
|
|
packagesWithBuildInputs = import ./packages-with-build-inputs.nix pkgs;
|
|
|
|
packagesRequireingX = import ./packages-requireing-x.nix;
|
|
|
|
packagesToSkipTests = import ./packages-to-skip-tests.nix;
|
2014-11-21 13:23:36 +00:00
|
|
|
|
|
|
|
defaultOverrides = old: new:
|
|
|
|
let old0 = old; in
|
|
|
|
let
|
|
|
|
old1 = old0 // (overrideRequireX packagesRequireingX old0);
|
|
|
|
old2 = old1 // (overrideSkipTests packagesToSkipTests old1);
|
|
|
|
old3 = old2 // (overrideNativeBuildInputs packagesWithNativeBuildInputs old2);
|
|
|
|
old4 = old3 // (overrideBuildInputs packagesWithBuildInputs old3);
|
|
|
|
old = old4;
|
2014-11-24 06:00:08 +00:00
|
|
|
in old // (import ./default-overrides.nix stdenv pkgs old new);
|
2014-08-13 17:26:08 +01:00
|
|
|
|
2014-05-04 14:21:12 +01:00
|
|
|
|
2014-11-21 13:23:36 +00:00
|
|
|
# Recursive override pattern.
|
|
|
|
# `_self` is a collection of packages;
|
|
|
|
# `self` is `_self` with overridden packages;
|
|
|
|
# packages in `_self` may depends on overridden packages.
|
|
|
|
overridden = (defaultOverrides _self self) // overrides;
|
|
|
|
|
2014-11-24 04:38:06 +00:00
|
|
|
maskedPackages = import ./masked-packages.nix;
|
2014-11-21 13:23:36 +00:00
|
|
|
masked = removeAttrs overridden maskedPackages;
|
|
|
|
|
|
|
|
self = masked;
|
|
|
|
_self = import ./sources.nix { inherit self derive; };
|
|
|
|
in
|
|
|
|
self
|