Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/types: allow changing the name of name #218812

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ rec {
, specialArgs ? {}
, shorthandOnlyDefinesConfig ? false
, description ? null
, nameArgument ? "name"
}@attrs:
let
inherit (lib.modules) evalModules;
Expand Down Expand Up @@ -724,7 +725,7 @@ rec {
# > and < wouldn't be encoded correctly so the encoded values
# would be used, and use of `<` and `>` would break the XML document.
# It shouldn't cause an issue since this is cosmetic for the manual.
_module.args.name = lib.mkOptionDefault "‹name›";
_module.args.${nameArgument} = lib.mkOptionDefault "‹name›";
}] ++ modules;
};

Expand All @@ -741,7 +742,7 @@ rec {
check = x: isAttrs x || isFunction x || path.check x;
merge = loc: defs:
(base.extendModules {
modules = [ { _module.args.name = last loc; } ] ++ allModules defs;
modules = [ { _module.args.${nameArgument} = last loc; } ] ++ allModules defs;
prefix = loc;
}).config;
emptyValue = { value = {}; };
Expand Down