-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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/nextcloud: Add ensureUsers option #248334
Conversation
c5ceac9
to
73032d4
Compare
exist yet. This option does not delete accounts which are not listed | ||
anymore. |
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.
When designing new options, why not make them fully declarative? Dump some state about which users are managed with by NixOS so that they can be removed again when they are removed from the config?
''; | ||
example = { | ||
user1 = { | ||
passwordFile = /secrets/user1-localhost; |
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 passwordFile options must be set with quoted strings, or else Nix will copy the secret into the world-readable Nix store at eval time (not so secret anymore).
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.
Very strong 👎
As pointed out by @bjornfor this is not declarative at all - except for dumping some state somewhere and as a result this strictly contradicts with what you can expect from NixOS in general. Granted, there are many other cases, but usually it was some necessary evil (e.g. you need to provide root credentials to set up Nextcloud initially), but in that case, there's no good reason!
@Ma27 Good point, I agree on this. But this argument somehow also applies to the current implementation of As pointed out in the PR description, it would be nice to move all So if I manage to migrate the Being able to add additional users is helpful with bootstrapping test and dev environments using the NixOS Nextcloud module :) But nevertheless I understand your concern :) |
Yeah, that's precisely what I meant with "necessary evil" in my previous comment ;-) I don't even see any value in this "feature": after the initial setup, the declaration of additional users is effectively worthless. As soon as such a user touches their email, the data in your deployment is outdated with no way to fix it (well, except for manual fixing up the deployment, but none of that will have any effect on the system you're deploying).
OK, if that's the only motivation behind that, then let's close this right away, please. NixOS isn't tooling to bootstrap dev environments, but a Linux distribution with modules that are supposed to be used in production. By the same argument we could enable XDebug by default in Nextcloud because it makes dev work way easier. For dev-only features, nothing stops you to write your own module for the nice interface. You can even add options from outside into |
Thank you @Ma27 for the feedback, sounds reasonable! Going to look on how to integrate this into an external flake module in case it's useful for someone |
Is someone still interested in using the ensureUsers option, I added a practical configuration example to the NixOS wiki https://nixos.wiki/wiki/Nextcloud#Add_users_declaratively |
Description of changes
Aiming to get rid of the
config
option in the Nextcloud module, having them all in the free form typeextraOptions
which can be renamed tosettings
in accordance to RFC42 in a later PR.Instead of defining a single admin user with
config.adminuser
andconfig.adminpassFile
switch to a more generic approach which is used by other modules, having aensureUsers
attribute set.For now I would like to only add the
ensureUsers
option to add additional users. In a later PR I would like to manage admin user configuration with this 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/
)