-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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/omnom: init module #357830
nixos/omnom: init module #357830
Conversation
72b9a54
to
0a5c1db
Compare
options = { | ||
services.omnom = { | ||
enable = lib.mkEnableOption "the omnom webpage bookmarking and snapshotting service."; | ||
debug = lib.mkEnableOption "the omnom debug mode."; |
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.
We do we have this option and the settings.app.debug
option
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 does seem a bit redundant. What do you think about keeping cfg.debug
and removing cfg.settings.app.debug
as the former is easier to set?
}; | ||
|
||
# If the service user is not dynamic, a normal group must exist | ||
users.groups = lib.mkIf ((!isDynamicUser) && (cfg.group == "omnom")) { omnom = { }; }; |
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.
What use-case is there for running the service without DynamicUser
?
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.
Currently, you can't register users from the command line if the service is running as a DynamicUser
. This is because the Omnom CLI tool runs as the user that starts it and it requires that all the files it needs are in its CWD.
As such, you'd need to cd into dataDir
and run the command, but normal users/groups can't access the DynamicUser
's work directory.
Another use-case is if you want to run the service as a normal user in your system.
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.
Currently, you can't register users from the command line if the service is running as a DynamicUser. This is because the Omnom CLI tool runs as the user that starts it and it requires that all the files it needs are in its CWD.
In that case we should create a wrapper script that changes the user and set the CWD to the dataDir. See the occ
wrapper in nextcloud module for example.
Another use-case is if you want to run the service as a normal user in your system.
As this disables some security features that systemd provides when using DynamicUser
I would personally recommend against it.
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.
In that case we should create a wrapper script that changes the user and set the CWD to the dataDir. See the occ wrapper in nextcloud module for example.
This is a great idea, but even with this, I wasn't able to create users from the command line as a DynamicUser
, as it can't cd there (which I even tried to do with systemd-run
).
I think that it'd probably be better to run the service non-dynamically for now until the program doesn't need to run from the CWD anymore. What do you think?
|
||
services.omnom.settings = { | ||
app.debug = lib.mkDefault cfg.debug; | ||
storage.type = lib.mkDefault "fs"; |
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.
Could you please move this into an option, this makes this default show option in the documentation.
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 was originally an option, but I removed it because fs
is currently the only variant for the storage type, so I don't think it's that useful for users.
9295fb1
to
ceba0b0
Compare
Should I squash the commits? |
Yes please :) |
ceba0b0
to
22752a0
Compare
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 hope I don't seam to picky :)
One thing that currently completely missing from the module is handling the SMTP password, this will probably require some preStart config patching. Have a look at the wg-access-server
module I've done something like that there.
Group = cfg.group; | ||
ExecStart = '' | ||
${lib.getExe cfg.package} listen \ | ||
--config /etc/omnom/config.yml \ |
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.
We don't need to link the config into /etc
we can just pass the store path directly.
By placing this in the let in at the top, where settingsFormat
is defined.
configFile = settingsFormat.generate "omnom-config.yml" cfg.settings;
And then replacing this line with --config ${configFile}
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.
In my opinion having the config in /etc
makes it easier for the users to find and read, without having to hunt down the generated config.
22752a0
to
ced18f7
Compare
I'll probably have a look at this tomorrow, thanks! |
aa3d3fa
to
0a745b6
Compare
These are the main changes from the recent squash:
Please let me know if there is anything else that should be improved :) |
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.
Think this is going to be the final review round :)
0a745b6
to
b35387b
Compare
b35387b
to
08cf9f3
Compare
Thanks everyone for your help and patience! ❤️ |
This probably deserves a release notes entry |
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.