cran-packages: combined packages definition files further

This commit is contained in:
taku0 2014-12-01 22:06:35 +09:00 committed by Peter Simons
parent 916e36940b
commit 2d3dd68d27
4 changed files with 6306 additions and 6315 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 = { packagesWithNativeBuildInputs = {
# sort -t '=' -k 2 # sort -t '=' -k 2
RAppArmor = [ pkgs.apparmor ]; RAppArmor = [ pkgs.apparmor ];
@ -873,5 +1057,5 @@ stdenv: pkgs:
]; ];
}); });
}; };
} in
self

View File

@ -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)) 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("# Execute the following command to update the file.\n")
cat("#\n") cat("#\n")
cat("# Rscript generate_sources.R > sources.nix\n") cat("# Rscript generate-cran-packages.R > cran-packages.nix\n")
cat("\n") cat("\n")
cat("{ self, derive }: with self; {\n") cat("{ self, derive }: with self; {\n")
cat(paste(nix, collapse="\n"), "\n") cat(paste(nix, collapse="\n"), "\n")

File diff suppressed because it is too large Load Diff