-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
nixos/syncthing: applied rfc42 and added some additional options #226088
Conversation
i have seen a moment ago that encyptionPassword will already get implemented by #205653. |
Can we use a generic settings* option (NixOS/rfcs#42) instead of having to duplicate every upstream option in downstream nixos? |
i have no problems with that @bjornfor . we could do that with the change to 23.05 but not in 22.11 atm because that could be breaking for some users |
tested together with @Lassulus and the tests worked |
ok, after spending an hour looking at the code, this would be my plan to move forward: rename the extraOptions to settings. move the devices & folders to settings and make them into freeformTypes (like extraOptions is now). Then we don't need to serialize all the possibe options for device, folder and global separately and only document the most important ones. |
2f2ccdf
to
3d77d9d
Compare
alright and I spend another hour doing that refactor, although it's not finished yet. I guess we don't need to document all the options (for example startBrowser, releasesUrl, ...) |
i just done the aditional like them because i had time :D |
df123d4
to
3498b5b
Compare
Related to #144575, too |
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.
Looks great to me! That's my only comment.
@@ -530,6 +520,10 @@ in { | |||
This option was removed because Syncthing now has the inotify functionality included under the name "fswatcher". | |||
It can be enabled on a per-folder basis through the web interface. | |||
'') | |||
(mkRenamedOptionModule [ "services" "syncthing" "extraOptions" ] [ "services" "syncthing" "settings" ]) | |||
(mkRenamedOptionModule [ "services" "syncthing" "folders" ] [ "services" "syncthing" "settings" "folders" ]) |
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.
Something like this (along with the other options):
(mkRenamedOptionModule [ "services" "syncthing" "folders" ] [ "services" "syncthing" "settings" "folders" ]) | |
(mkRenamedOptionModule [ "services" "syncthing" "folders" ] [ "services" "syncthing" "settings" "folders" ]) | |
(mkRenamedOptionModule [ "services" "syncthing" "folders" "rescanIntervalS" ] [ "services" "syncthing" "settings" "folders" "rescanInterval" ]) |
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.
hmm, this gives me an eval error. not sure how we can fix that
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.
Because the folder's path is supposed to be in between the "folders"
and the rescanIntervalS
... I'm not sure how to do that, as the path can be anything of course.
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 tend to think it's impossible to perform such a 'variable' rename. If indeed we won't find a way to do it, I think it'd be OK to give up on this, as anyway we rename an module option a level higher, which might trigger hopefully a second look on the documentation anyway..
Also, in anycase, it'd be nice to mention all of the changes here in the release notes.. (@Xyz00777 )
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.
...so the solution we went with here is really "silently ignore the problem and hope the user will read the release notes"? How is this acceptable?
We should either reintroduce the mapping or add an assertion.
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.
...so the solution we went with here is really "silently ignore the problem and hope the user will read the release notes"? How is this acceptable?
We should either reintroduce the mapping or add an assertion.
Indeed I forgot about the release notes entry... If you know how to create that mapping, or add an assertion, I'd be happy to review and test it. I am not sure it's possible to do it TBH. I also asked for help on discourse and got no response.
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.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
@Xyz00777 could you please also perform the proper renames in:
|
Friendly ping @Xyz00777 . Could you help us with the |
Hi sorry for my delay, I forgot to answer. I had question @Lassulus because I didn't know how to add them and he mean that he already answered an question like that somewhere. Thanks for the merge! :) I will try to get better with nix for doing it myself |
Looks like this introduced a regression in configuration. Setting for example |
What do you mean by "doesn't work"? Do you mean that it is essentially ignored?
…On 17 May 2023 15:56:47 GMT+03:00, Azat Bahawi ***@***.***> wrote:
Looks like this introduced a regression in configuration. Setting for example `services.syncthing.settings.options.autoUpgradeIntervalH` or `services.syncthing.settings.folders.${name}.versioning.params` doesn't work anymore for me.
--
Reply to this email directly or view it on GitHub:
#226088 (comment)
You are receiving this because you modified the open/close state.
Message ID: ***@***.***>
|
cfg.devices != {} || cfg.folders != {} || cfg.extraOptions != {} | ||
cfg.settings.devices != {} || cfg.folders != {} || cfg.extraOptions != {} |
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.
This looks suspicious
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.
Indeed this looks bad. What do you think about simplify it to:
diff --git i/nixos/modules/services/networking/syncthing.nix w/nixos/modules/services/networking/syncthing.nix
index b5ebda6da04..d5531409428 100644
--- i/nixos/modules/services/networking/syncthing.nix
+++ w/nixos/modules/services/networking/syncthing.nix
@@ -610,7 +610,7 @@ in {
};
};
syncthing-init = mkIf (
- cfg.settings.devices != {} || cfg.folders != {} || cfg.extraOptions != {}
+ cfg.settings != {}
) {
description = "Syncthing configuration updater";
requisite = [ "syncthing.service" ];
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.
sure
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.
That condition hasn't prevented the syncthing-init.service
from being generated, and this is not the issue @azahi is experiencing. It is still worth fixing though.
|
Could this be some kind of an attribute name collision with nixpkgs module system? |
fsPath = mkOption { | ||
default = ""; | ||
type = either str path; | ||
|
||
id = mkOption { | ||
type = types.str; | ||
description = mdDoc '' | ||
Path to the versioning folder. | ||
See <https://docs.syncthing.net/users/versioning.html>. | ||
The device ID. See <https://docs.syncthing.net/dev/device-ids.html>. | ||
''; | ||
}; | ||
params = mkOption { | ||
type = attrsOf (either str path); | ||
|
||
autoAcceptFolders = mkOption { | ||
type = types.bool; | ||
default = false; | ||
description = mdDoc '' | ||
The parameters for versioning. Structure depends on | ||
[versioning.type](#opt-services.syncthing.folders._name_.versioning.type). | ||
See <https://docs.syncthing.net/users/versioning.html>. | ||
Automatically create or share folders that this device advertises at the default path. | ||
See <https://docs.syncthing.net/users/config.html?highlight=autoaccept#config-file-format>. | ||
''; | ||
}; |
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.
First error @azahi reports is due to these options being removed without a corresponding freeformType
added.
''; | ||
}; | ||
type = types.attrsOf (types.submodule ({ name, ... }: { |
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.
Second issue @azahi reports is due to the extra attrsOf
here.
#232439 should fix both issues, please double-check. |
nixos/syncthing: fixup #226088
Well done! Working on a release notes PR right now.
…On Wed, May 17, 2023 at 12:20:11PM -0700, Naïm Favier wrote:
@ncfavier commented on this pull request.
> @@ -530,6 +520,10 @@ in {
This option was removed because Syncthing now has the inotify functionality included under the name "fswatcher".
It can be enabled on a per-folder basis through the web interface.
'')
+ (mkRenamedOptionModule [ "services" "syncthing" "extraOptions" ] [ "services" "syncthing" "settings" ])
+ (mkRenamedOptionModule [ "services" "syncthing" "folders" ] [ "services" "syncthing" "settings" "folders" ])
I've added an assertion in #232439. We can't use the module system for this because of #96006.
Could you open a PR for the release note entry?
--
Reply to this email directly or view it on GitHub:
#226088 (comment)
You are receiving this because you modified the open/close state.
Message ID: ***@***.***>
|
It seems like this PR caused more damage than expected and everyone seems to continue moving forward on this. Breaking changes were RESTRICTED since a while. I was affected too, please tell me what's your plan forward regarding the blast area caused by those changes? If not, please consider a mass revert of those changes and wait for branch-off which is supposed to take place in 4 days if you cannot stabilize those changes. |
Sad but absolutely okay and understandable for me @Lassulus how far is the fix you wanted to make? I didn't tracked all the changes and messages everyone done here... |
I think the main problem is that it's not clear any longer how to detect whether the user intends to manage their configuration declaratively. Previously we could test each of This check is important to avoid destroying users' imperatively configured folders and devices (see the original motivation for #62157). Beyond that, as mentioned in #232679 (comment), I am not convinced we need to move |
The breaking change in this patch note has been reverted for now, see NixOS#226088.
Ever since this PR [1], some of the Syncthing options that I’ve been using have new names. The old names are deprecated. This commit makes it so that I don’t use the deprecated names anymore. Fixes <mid:bu4dbznoivldxaxkdyzkd472vryl7wqzcvjunrg5pqe7ta5bu4@6pic33ncld5n>. [1]: <NixOS/nixpkgs#226088>
Description of changes
try to implement options who are not available as nixos options at the moment, e.g. copyOwnershipFromParent who is a suboptions of folders and can not be implemented at the moment with the extraoptions option.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)its my first commit and merge request for nixos, so i sadly have absolut no plan how to test the new config.
I tried to implement all options i found beside of
<minDiskFree unit="%">1</minDiskFree>
in options and folders because i didnt know how to implement that and also not<encryptionPassword></encryptionPassword>
under folders.device.If someone could help me i would really like to see that :)
Greetings