Skip to content
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

MySQL configuration not honoured in shell #1458

Open
liammcdermott opened this issue Sep 19, 2024 · 0 comments
Open

MySQL configuration not honoured in shell #1458

liammcdermott opened this issue Sep 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@liammcdermott
Copy link

liammcdermott commented Sep 19, 2024

Describe the bug

When services.mysql.settings.client has some values, such as database or socket, those settings are not used by the MySQL client in the devenv shell.

To reproduce

I was able to reproduce the issue in a new devenv project. Run devenv init, then use this devenv.nix:
https://gist.github.com/liammcdermott/9c92bdac1f2383c1601ce676316adebb

Run mysql and notice it is not using the configuration set in devenv.nix. For example, it should connect to the database using the correct socket path, but instead uses its own default.

This appears to be because the upstream package binary is taking precedence over scripts.mysql.exec in the PATH.

Workaround

Place this in the let bindings of devenv.nix:

  mysqlWrapped = pkgs.writeShellScriptBin "mysql" ''
    exec ${config.scripts.mysql.exec} "$@"
  '';

and this in the body of devenv.nix, inside enterShell:

export PATH="${mysqlWrapped}/bin":$PATH

Maybe this is the intended behaviour? It feels a bit sub-optimal to have to re-wrap the MySQL binaries though.

Version

devenv 1.1.0 (x86_64-linux)

I am not using Flakes.

@liammcdermott liammcdermott added the bug Something isn't working label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant