mirror of
https://github.com/nix-community/flakelight.git
synced 2025-06-25 03:51:32 +02:00
Fix merge function for custom option types
If merge is not set for an option type, it will use the default merge function; this was not what was intended. Updated the merge values for options that did not set one to mergeOneOption or mergeEqualOption.
This commit is contained in:
parent
b0fd6a391c
commit
fad306c589
@ -7,6 +7,7 @@ let
|
|||||||
inherit (builtins) isPath isString;
|
inherit (builtins) isPath isString;
|
||||||
inherit (lib) mkOption mkOptionType mkIf mkMerge;
|
inherit (lib) mkOption mkOptionType mkIf mkMerge;
|
||||||
inherit (lib.types) lazyAttrsOf nullOr;
|
inherit (lib.types) lazyAttrsOf nullOr;
|
||||||
|
inherit (lib.options) mergeEqualOption;
|
||||||
|
|
||||||
template = mkOptionType {
|
template = mkOptionType {
|
||||||
name = "template";
|
name = "template";
|
||||||
@ -15,6 +16,7 @@ let
|
|||||||
check = x: (x ? path) && (isPath x.path) &&
|
check = x: (x ? path) && (isPath x.path) &&
|
||||||
(x ? description) && (isString x.description) &&
|
(x ? description) && (isString x.description) &&
|
||||||
((! x ? welcomeText) || (isString x.welcomeText));
|
((! x ? welcomeText) || (isString x.welcomeText));
|
||||||
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ let
|
|||||||
mapAttrsToList pathExists pipe removePrefix removeSuffix evalModules
|
mapAttrsToList pathExists pipe removePrefix removeSuffix evalModules
|
||||||
mkDefault mkOptionType singleton;
|
mkDefault mkOptionType singleton;
|
||||||
inherit (nixpkgs.lib.types) coercedTo functionTo listOf;
|
inherit (nixpkgs.lib.types) coercedTo functionTo listOf;
|
||||||
|
inherit (nixpkgs.lib.options) mergeEqualOption mergeOneOption;
|
||||||
|
|
||||||
builtinModules = mapAttrsToList (k: _: ./builtinModules + ("/" + k))
|
builtinModules = mapAttrsToList (k: _: ./builtinModules + ("/" + k))
|
||||||
(readDir ./builtinModules);
|
(readDir ./builtinModules);
|
||||||
@ -49,6 +50,7 @@ let
|
|||||||
description = "package definition";
|
description = "package definition";
|
||||||
descriptionClass = "noun";
|
descriptionClass = "noun";
|
||||||
check = isFunction;
|
check = isFunction;
|
||||||
|
merge = mergeOneOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
path = mkOptionType {
|
path = mkOptionType {
|
||||||
@ -56,6 +58,7 @@ let
|
|||||||
description = "path";
|
description = "path";
|
||||||
descriptionClass = "noun";
|
descriptionClass = "noun";
|
||||||
check = isPath;
|
check = isPath;
|
||||||
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = mkOptionType {
|
module = mkOptionType {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user