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/mysql: fix typing-induced bugs #58702
Conversation
and increase test coverage to catch this
which was wrongly specified as types.lines Prevent it from getting copied to nix store as people might use it for credentials, and make the tests cover it.
@schneefux can you give this a test, please? I don't personally use those two features, which is why those errors slipped through. Therefore tried to improve test coverage for those. This should also fix the issue you would have come up with next, as |
@GrahamcOfBorg test mysql |
Yeah, that works. Good job, thank you! |
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.
nixpkgs/nixos/modules/services/databases/mysql.nix
Lines 366 to 375 in 14571f5
# TODO: this silently falls through if database.schema does not exist, | |
# we should catch this somehow and exit, but can't do it here because we're in a subshell. | |
if [ -f "${database.schema}" ] | |
then | |
cat ${database.schema} | |
elif [ -d "${database.schema}" ] | |
then | |
cat ${database.schema}/mysql-databases/*.sql | |
fi | |
''} |
Can you please provide some documentation explaining how the user can make use of line 373? Seems like a useful feature that most people wouldn't even know exists.
Ping :-) Ran into the current breakage at #57550 (comment) too. |
I'll merge this for now @aanderse This can be done in a follow-up PR. For now fixing this regression is more important. |
@infinisil @flokli Yes, sorry. This sorta fell off my radar and I should have circled back. Thanks. |
@aanderse sorry for my absence, and thanks for your review. While you're right and I think know how that option is intended, I never used it and will therefore refrain from trying to improve it, as this was how I introduced this regression in the first place. :/ |
@florianjacob no problem, fair enough. |
Motivation for this change
Fixes issues brought up by @schneefux in #58582.
This also tries to prevent
mysql.initialScript
from ending up in /nix/store when given as nix path type, i.e.initialScript = /etc/nixos/setup-credentials.sql
in contrast toinitialScript = "/etc/nixos/setup-credentials.sql";
, as it might be used for sensitive data like credentials. UsestoString
for this, as explained here: https://stackoverflow.com/questions/43850371/when-does-a-nix-path-type-make-it-into-the-nix-store-and-when-notThings done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)