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 10:55:45 +00:00
|
|
|
derive = lib.makeOverridable ({
|
|
|
|
name, version, sha256,
|
|
|
|
depends ? [],
|
|
|
|
doCheck ? true,
|
|
|
|
requireX ? false,
|
|
|
|
broken ? 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-24 06:29:56 +00:00
|
|
|
inherit doCheck 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-24 10:55:45 +00:00
|
|
|
meta.broken = broken;
|
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-24 06:29:56 +00:00
|
|
|
# Overrides package definition to skip check.
|
2014-11-21 13:23:36 +00:00
|
|
|
# For example,
|
|
|
|
#
|
2014-11-24 06:29:56 +00:00
|
|
|
# overrideSkipCheck [
|
2014-11-21 13:23:36 +00:00
|
|
|
# "foo"
|
|
|
|
# ] old
|
|
|
|
#
|
|
|
|
# results in
|
|
|
|
#
|
|
|
|
# {
|
|
|
|
# foo = old.foo.override {
|
2014-11-24 06:29:56 +00:00
|
|
|
# doCheck = false;
|
2014-11-21 13:23:36 +00:00
|
|
|
# };
|
|
|
|
# }
|
2014-11-24 06:29:56 +00:00
|
|
|
overrideSkipCheck = packageNames: old:
|
2014-11-21 13:23:36 +00:00
|
|
|
let
|
|
|
|
nameValuePairs = map (name: {
|
|
|
|
inherit name;
|
|
|
|
value = (builtins.getAttr name old).override {
|
2014-11-24 06:29:56 +00:00
|
|
|
doCheck = false;
|
2014-11-21 13:23:36 +00:00
|
|
|
};
|
|
|
|
}) packageNames;
|
|
|
|
in
|
|
|
|
builtins.listToAttrs nameValuePairs;
|
|
|
|
|
2014-11-24 10:55:45 +00:00
|
|
|
# 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;
|
|
|
|
|
2014-11-29 13:13:11 +00:00
|
|
|
inherit (import ./default-overrides.nix stdenv pkgs)
|
|
|
|
packagesWithNativeBuildInputs
|
|
|
|
packagesWithBuildInputs
|
|
|
|
packagesRequireingX
|
|
|
|
packagesToSkipCheck
|
|
|
|
brokenPackages
|
|
|
|
otherOverrides;
|
2014-11-21 13:23:36 +00:00
|
|
|
|
|
|
|
defaultOverrides = old: new:
|
|
|
|
let old0 = old; in
|
|
|
|
let
|
|
|
|
old1 = old0 // (overrideRequireX packagesRequireingX old0);
|
2014-11-24 06:29:56 +00:00
|
|
|
old2 = old1 // (overrideSkipCheck packagesToSkipCheck old1);
|
2014-11-21 13:23:36 +00:00
|
|
|
old3 = old2 // (overrideNativeBuildInputs packagesWithNativeBuildInputs old2);
|
|
|
|
old4 = old3 // (overrideBuildInputs packagesWithBuildInputs old3);
|
2014-11-24 10:55:45 +00:00
|
|
|
old5 = old4 // (overrideBroken brokenPackages old4);
|
|
|
|
old = old5;
|
2014-11-29 13:13:11 +00:00
|
|
|
in old // (otherOverrides old new);
|
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.
|
2014-11-24 10:55:45 +00:00
|
|
|
self = (defaultOverrides _self self) // overrides;
|
2014-11-21 13:23:36 +00:00
|
|
|
_self = import ./sources.nix { inherit self derive; };
|
|
|
|
in
|
|
|
|
self
|