mirror of
https://github.com/nix-community/home-manager
synced 2024-11-16 08:09:45 +01:00
6c127efb2d
Given an inner type, the former function generates a type that expect DAG option values. The latter function is only present to temporarily allow the `programs.ssh.matchBlocks` to keep accepting list values.
37 lines
908 B
Nix
37 lines
908 B
Nix
{ lib, dag ? import ./dag.nix { inherit lib; } }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
hmLib = import ./default.nix { inherit lib; };
|
|
typesDag = import ./types-dag.nix { inherit dag lib; };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit (typesDag) dagOf listOrDagOf;
|
|
|
|
selectorFunction = mkOptionType {
|
|
name = "selectorFunction";
|
|
description =
|
|
"Function that takes an attribute set and returns a list"
|
|
+ " containing a selection of the values of the input set";
|
|
check = isFunction;
|
|
merge = _loc: defs:
|
|
as: concatMap (select: select as) (getValues defs);
|
|
};
|
|
|
|
overlayFunction = mkOptionType {
|
|
name = "overlayFunction";
|
|
description =
|
|
"An overlay function, takes self and super and returns"
|
|
+ " an attribute set overriding the desired attributes.";
|
|
check = isFunction;
|
|
merge = _loc: defs:
|
|
self: super:
|
|
foldl' (res: def: mergeAttrs res (def.value self super)) {} defs;
|
|
};
|
|
|
|
}
|