mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
modules/dependencies: restore literal expression example support
This commit is contained in:
parent
fb80e0d0b5
commit
55ad604d44
1 changed files with 18 additions and 11 deletions
|
@ -16,20 +16,27 @@ let
|
||||||
lib.mkPackageOption pkgs name properties
|
lib.mkPackageOption pkgs name properties
|
||||||
# Handle example manually so that we can embed the original attr-path within
|
# Handle example manually so that we can embed the original attr-path within
|
||||||
# the literalExpression object. This simplifies testing the examples.
|
# the literalExpression object. This simplifies testing the examples.
|
||||||
// lib.optionalAttrs (properties.example != null) {
|
// lib.optionalAttrs (builtins.isList properties.example) {
|
||||||
example =
|
example = {
|
||||||
if properties.example._type or null == "literalExpression" then
|
_type = "literalExpression";
|
||||||
properties.example
|
text = "pkgs.${lib.showAttrPath properties.example}";
|
||||||
else
|
path = properties.example;
|
||||||
{
|
};
|
||||||
_type = "literalExpression";
|
}
|
||||||
text = "pkgs.${lib.showAttrPath properties.example}";
|
// lib.optionalAttrs (literalExpressionType.check properties.example) {
|
||||||
path = properties.example;
|
inherit (properties) example;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
attrPathType = with types; coercedTo str lib.toList (listOf str);
|
attrPathType = with types; coercedTo str lib.toList (listOf str);
|
||||||
|
|
||||||
|
literalExpressionType = lib.types.mkOptionType {
|
||||||
|
name = "literal-expression";
|
||||||
|
description = "literal expression";
|
||||||
|
descriptionClass = "noun";
|
||||||
|
merge = lib.options.mergeEqualOption;
|
||||||
|
check = v: v ? _type && (v._type == "literalExpression" || v._type == "literalMD");
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
@ -46,7 +53,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
example = lib.mkOption {
|
example = lib.mkOption {
|
||||||
type = types.nullOr attrPathType;
|
type = types.nullOr (types.either attrPathType literalExpressionType);
|
||||||
description = ''
|
description = ''
|
||||||
Attribute path for an alternative package that provides dependency, relative to `pkgs`.
|
Attribute path for an alternative package that provides dependency, relative to `pkgs`.
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue