-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
obsidian: add extraSettings #7294
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
base: master
Are you sure you want to change the base?
Conversation
@@ -385,6 +385,12 @@ in | |||
); | |||
default = { }; | |||
}; | |||
|
|||
extraSettings = mkOption { | |||
description = "Additional settings to include in obsidian.json."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"include" would suggest this doesn't override the other options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, cause it merged via //, or what are u talking about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//
does override, for example
nix-repl> { vaults = { foo = "x"; }; } // { vaults = { foo = "y"; }; }
{
vaults = {
foo = "y";
};
}
I'm suggesting either changing the description (probably the better option) or using mkMerge in the application. Usually extraSettings are just dumped at the end of the file, but that obviously doesn't work for json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it overrides if you merging same name attribute, but in obsidian you can't set anything via built-in settings, only nix settings because obsidian.json read only, understood?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what they're saying is that //
is a shallow merge, which means that it'd be impossible to append a deeply-nested key. For example, let's say that you have:
{ a.b.c = 1; }
and you want to add a new attribute: { a.b.x = 2; }
. With //
, the previous value in a.b.c
will not be preserved:
nix-repl> :p { a.b.c = 1; } // { a.b.x = 2; }
{
a = {
b = { x = 2; };
};
}
This is surprising compared to the extra{Settings,Config}
options in other modules. By using mkMerge
, { a.b.c = 1; }
and { a.b.x = 2; }
will be merged so that:
{
a = {
b = { c = 1; x = 2; };
};
}
Description
added extraSettings to obsidian module
Example
Checklist
Change is backwards compatible.
Code formatted with nix fmt or
nix-shell -p treefmt nixfmt-rfc-style keep-sorted --run treefmt.
Code tested through nix-shell --pure tests -A run.all
or nix build --reference-lock-file flake.lock ./tests#test-all using Flakes.
Test cases updated/added. See example.
Commit messages are formatted like
{component}: {description}
{long description}
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC
@rycee @karaolidis