useVersion function added

svn path=/nixpkgs/trunk/; revision=9669
This commit is contained in:
Yury G. Kudryashov 2007-11-14 21:57:26 +00:00
parent 1aa59d5407
commit c9560ff4b1
1 changed files with 7 additions and 0 deletions

View File

@ -147,6 +147,13 @@ rec {
getVersion = name: alts: builtins.getAttr
(getConfig [ "environment" "versions" name ] "default") alts;
# The same, another syntax.
# Warning: syntax for configuration.nix changed too
useVersion = name: f: f
{
version = getConfig [ "environment" "versions" name ];
};
# Whether user enabled given feature for the given package?
getFlag = flag: package: default:
getConfig [ "environment" "flags" package flag ]