1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-01-22 14:45:27 +00:00

Added support for overridable variants of package.

For details read comments near getVersion function, gettext is the current
example.

svn path=/nixpkgs/trunk/; revision=9235
This commit is contained in:
Yury G. Kudryashov 2007-09-01 18:26:13 +00:00
parent 045764d028
commit 245655b7a1
5 changed files with 28 additions and 2 deletions

View file

@ -1 +1,8 @@
import ./gettext-0.14.6.nix
args:
rec {
recurseForDerivations = true;
default = v_0_14_6;
v_0_14_6 = (import ./0.14.6.nix) args;
v_0_15 = (import ./0.15.nix) args;
v_0_16_x = (import ./0.16.x.nix) args;
}

View file

@ -129,6 +129,23 @@ rec {
# a default value if the attribute doesn't exist.
getConfig = attrPath: default: library.getAttr attrPath default config;
# Return user-choosen version of given package. If you define package as
#
# pkgname_alts =
# {
# v_0_1 = ();
# v_0_2 = ();
# default = v_0_1;
# recurseForDerivations = true;
# };
# pkgname = getVersion "name" pkgname_alts;
#
# user will be able to write in his configuration.nix something like
# environment = { versions = { name = v_0_2; }; }; and pkgname will be equal
# to pkgname_alts.v_0_2. Using alts.default by default.
getVersion = name: alts: builtins.getAttr
(getConfig [ "environment" "versions" name ] "default") alts;
# The contents of the configuration file found at $NIXPKGS_CONFIG or
# $HOME/.nixpkgs/config.nix.
config =
@ -1439,7 +1456,9 @@ rec {
inherit fetchurl stdenv;
};
gettext = import ../development/libraries/gettext {
gettext = getVersion "gettext" gettext_alts;
gettext_alts = import ../development/libraries/gettext {
inherit fetchurl stdenv;
};