* Quick proof-of-concept of making it easy to override package
configuration options in ~/.nixpkgs/config.nix. Example: { packageOverrides = pkgs: { subversion = pkgs.subversion.function (origArgs: { bdbSupport = false; pythonBindings = !origArgs.pythonBindings; }); }; } I.e. pkgs.subversion.function is the original function call to the Subversion function in all-packages.nix. This requires the "subversion" attribute to use makeOverridable, which stores the original function and function arguments in the "function" attribute of the result. svn path=/nixpkgs/trunk/; revision=12728
This commit is contained in:
parent
6dbbd93d03
commit
5e5eeedaa6
@ -63,12 +63,20 @@ let
|
|||||||
# configuration option, which must be a function that takes `pkgs'
|
# configuration option, which must be a function that takes `pkgs'
|
||||||
# as an argument and returns a set of new or overriden packages.
|
# as an argument and returns a set of new or overriden packages.
|
||||||
# `__overrides' is a magic attribute that causes the attributes in
|
# `__overrides' is a magic attribute that causes the attributes in
|
||||||
# its value to be added to the surrounding `rec'.
|
# its value to be added to the surrounding `rec'. The
|
||||||
__overrides = (getConfig ["packageOverrides"] (pkgs: {})) pkgs;
|
# `packageOverrides' function is called with the *original*
|
||||||
|
# (un-overriden) set of packages, allowing packageOverrides
|
||||||
|
# attributes to refer to the original attributes (e.g. "foo =
|
||||||
|
# ... pkgs.foo ...").
|
||||||
|
__overrides = (getConfig ["packageOverrides"] (pkgs: {})) pkgsOrig;
|
||||||
|
|
||||||
|
pkgsOrig = pkgsFun {}; # the un-overriden packages, passed to packageOverrides
|
||||||
|
pkgsOverriden = pkgsFun __overrides; # the overriden, final packages
|
||||||
|
pkgs = pkgsOverriden;
|
||||||
|
|
||||||
|
|
||||||
# The package compositions. Yes, this isn't properly indented.
|
# The package compositions. Yes, this isn't properly indented.
|
||||||
pkgs = rec {
|
pkgsFun = __overrides: rec {
|
||||||
|
|
||||||
|
|
||||||
inherit __overrides;
|
inherit __overrides;
|
||||||
@ -294,6 +302,10 @@ let
|
|||||||
in
|
in
|
||||||
import (dir + "/${pVersion}.nix") (args // { version = pVersion; });
|
import (dir + "/${pVersion}.nix") (args // { version = pVersion; });
|
||||||
|
|
||||||
|
makeOverridable = f: origArgs: f origArgs //
|
||||||
|
{ function = newArgsFun: makeOverridable f (origArgs // (newArgsFun origArgs));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
### STANDARD ENVIRONMENT
|
### STANDARD ENVIRONMENT
|
||||||
|
|
||||||
@ -6691,7 +6703,7 @@ let
|
|||||||
|
|
||||||
subversion = subversion14;
|
subversion = subversion14;
|
||||||
|
|
||||||
subversion14 = import ../applications/version-management/subversion-1.4.x {
|
subversion14 = makeOverridable (import ../applications/version-management/subversion-1.4.x) {
|
||||||
inherit fetchurl stdenv apr aprutil expat swig zlib jdk;
|
inherit fetchurl stdenv apr aprutil expat swig zlib jdk;
|
||||||
neon = neon026;
|
neon = neon026;
|
||||||
bdbSupport = getConfig ["subversion" "bdbSupport"] true;
|
bdbSupport = getConfig ["subversion" "bdbSupport"] true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user