-
-
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/postgresql: add ensureDatabases.*.withOptions #339195
base: master
Are you sure you want to change the base?
nixos/postgresql: add ensureDatabases.*.withOptions #339195
Conversation
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.
Nice changes, diff LGTM at first sight. I haven't tested 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.
Could the option use apply
instead to convert stringly-typed options to the module, with an empty withOptions
?
This would make the module implementation simpler.
I don't quite understand the meaning of this sentence, possibly because I am not a native English speaker. Do you mean assigning a separate type to each option rather than using str for all of them? |
@luochen1990 In this instance, I'm suggesting using it to convert from the stringly-typed option to the full-featured module, which would mean not having to worry about handling bare strings in the rest of the module. EDIT: I'm having trouble finding the documentation for this in the manual, I could have sworn it was explained somewhere in the NixOS manual... |
Good suggestion! thanks for telling me this, I will change to use that now! |
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.
Can you please adjust the PR title and commit log message... and make sure there's only 1 commit in here?
What should the PR title look like? |
e6ee66e
to
15ef01d
Compare
Please read again: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions |
15ef01d
to
f885fef
Compare
f885fef
to
296301b
Compare
Because GitLab supports selecting the squash option when merging, I originally thought GitHub also supported this feature, so I would usually try to keep the commit history as much as possible, but I didn't expect GitHub to have fewer features than GitLab .. |
There's no consensus on this in |
I think this is already solved, but I don't know how to mark it as solved. |
Yes, I received all the notifications and saw it. The Diff LGTM but I'll let someone else handle the review carefully. |
@drupol There might be string literal escaping issue, I'm not sure if there are existing codes to reuse. |
I won't be able to test it, I'm not using postgresql. That's the reason why I left this PR for someone else. |
a1ac31e
to
6ca042d
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.
AFAIU the options
part is a tombstone as soon as the DB is created, correct? I.e. if the DB exists and you change one of the options, nothing happens.
Doesn't seem very intuitive (or declarative!) to me.
I think the entire approach here is inherently flawed. Also, the reminder that the ensure* stuff caused major pain during the last two NixOS releases for the postgresql maintainers: #318777, #266270.
\I'd rather not merge.
Thanks for your reply. I have give my opinion about "the ensure anti-pattern"* in #107342 (comment) I think we can improve it instead of just delete it and use a worse solution to just make less promise to user. |
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.
For the current state of the change, all of my criticism voiced above still applies, hence "requesting changes" for now.
Will get back to you in the other thread this afternoon (CEST), OK? :)
Description of changes
Make
services.postgresql.ensureDatabases
support not only str as dbname, but also submodule to specifywithOptions
likeOWNER
,TEMPLATE
,ENCODING
,LOCALE
, etc.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.