-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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/automx2: multi-domain support, service improvements, configurability #370074
base: master
Are you sure you want to change the base?
Conversation
a016f94
to
d980834
Compare
check = | ||
x: | ||
if !builtins.isAttrs x then | ||
false | ||
else if !lib.types.str.check x.type then | ||
false | ||
else if x.type != "imap" && x.type != "smtp" then | ||
false | ||
else if !lib.types.str.check x.name then | ||
false | ||
else if !lib.types.port.check x.port then | ||
false | ||
else | ||
true; |
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 don't get this
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.
Do you refer to the individual checks or the overall approach?
- individual checks: I'll add comments to make them easier to understand
- general approach: my goal was, to properly validate the JSON datastructure that needs to be passed to
/initdb
to catch issues at evaluation instead of at runtime with a failing service startup…- Is there a better way than using custom types?
- Is my approach of using type checks wrong?
check = | ||
x: | ||
if !builtins.isAttrs x then | ||
false | ||
else if | ||
!builtins.all (key: builtins.hasAttr key x) [ | ||
"type" | ||
"url" | ||
"port" | ||
] | ||
then | ||
false | ||
else if !lib.types.str.check x.type then | ||
false | ||
else if x.type != "caldav" && x.type != "carddav" then | ||
false | ||
else if !lib.types.str.check x.url then | ||
false | ||
else if !lib.types.port.check x.port then | ||
false | ||
else | ||
true; |
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.
or this check
check = | ||
x: | ||
if !lib.isList x then | ||
false | ||
else if builtins.length x < 1 then | ||
false | ||
else if !lib.all (item: imapSmtpServerType.check item || davServerType.check item) x then | ||
false | ||
else | ||
true; |
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.
or 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.
otherwise good idea
@@ -30,6 +32,15 @@ buildPythonPackage rec { | |||
flask | |||
flask-migrate | |||
ldap3 | |||
pythonPackages.sdnotify |
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.
pythonPackages.sdnotify | |
sdnotify |
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.
The nixos/automx2: deprecate sleep hack, use sdnotify
commit can be squashed into the last commit
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 you referred to the commit which introduced sdnotify support, but since this one targeted the pkg and not the module, this shouldn't be done.
8c22197
to
059e077
Compare
059e077
to
49f470c
Compare
04f20f9
to
ee633d2
Compare
The existing approach only allowed to configure a single domain, while the upstream project itself supports multiple ones. By changing the option `domain` from a string to the option `domains` being a list and then configuring the nginx virtualHosts accordingly, multi-domain support works now as expected.
Since `automx2` is stateless in its current form, there's no need for `StateDirectory=` and `WorkingDirectory=`.
This release adds support for `sd_notify()`, which allows the corresponding `services.automx2` module to deprecate a `sleep` workaround. See also: rseichter/automx2#29
Eliminate the `sleep` hack before sending a request to `/initdb` by utilizing systemd's sdnotify which allows a more deterministic and race-free execution of `ExecStartPost=` processes once the service is ready.
ee633d2
to
89aa312
Compare
This PR adds multiple improvements to the
automx2
service, such as:settings
as proper validated option instead of a plain JSON stringDynamicUser=
and get rid of extra service userSince this is still WIP and only a draft PR so far, pinging @SuperSandro2000 as the original committer of this module for early input.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.