Add merge capabilities to nixpkgs.config option.
svn path=/nixos/trunk/; revision=29021
This commit is contained in:
parent
def746fcdd
commit
6669cf61f4
@ -1,5 +1,32 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
isConfig = x:
|
||||||
|
builtins.isAttrs x || builtins.isFunction x;
|
||||||
|
|
||||||
|
optCall = f: x:
|
||||||
|
if builtins.isFunction f
|
||||||
|
then f x
|
||||||
|
else f;
|
||||||
|
|
||||||
|
mergeConfig = lhs: rhs:
|
||||||
|
lhs // rhs //
|
||||||
|
optionalAttrs (lhs ? packageOverrides) {
|
||||||
|
packageOverrides = pkgs:
|
||||||
|
optCall lhs.packageOverrides pkgs //
|
||||||
|
optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
configType = mkOptionType {
|
||||||
|
name = "nixpkgs config";
|
||||||
|
check = traceValIfNot isConfig;
|
||||||
|
merge = fold mergeConfig {};
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
@ -8,8 +35,17 @@
|
|||||||
example = {
|
example = {
|
||||||
firefox.enableGeckoMediaPlayer = true;
|
firefox.enableGeckoMediaPlayer = true;
|
||||||
};
|
};
|
||||||
|
type = configType;
|
||||||
description = ''
|
description = ''
|
||||||
The configuration of the Nix Packages collection.
|
The configuration of the Nix Packages collection. This expression
|
||||||
|
defines default value of attributes and allow packages to be
|
||||||
|
overriden globally via the `packageOverrides'.
|
||||||
|
|
||||||
|
the `packageOverrides' configuration option must be a set of new or
|
||||||
|
overriden packages. Any occurence of `pkgs' inside this attribute
|
||||||
|
set refers to the *original* (un-overriden) set of packages,
|
||||||
|
allowing packageOverrides attributes to refer to the original
|
||||||
|
attributes (e.g. "packageOverrides.foo = ... pkgs.foo ...").
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user