purcell / sqlformat

Reformat SQL code inside Emacs using sqlformat or pgformatter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I use the full path of a tool with sqlformat-command?

bbigras opened this issue · comments

I would like to do this with nix instead of adding sqlfluff in my path.

{
  sqlformat = {
    enable = true;
    hook = [
      "(sql-mode-hook . sqlformat-on-save-mode)"
    ];
    config = ''
    (setq sqlformat-command "${pkgs.sqlfluff}/bin/sqlfluff")
    (setq sqlformat-args '("fix" "-f" "-"))
  '';
  };
}

Hey! Currently - somewhat embarrassingly - that's not possible because the executable is just found off the path. What I do personally with Nix is to have a per-project shell.nix for tools, and then I use envrc.el and direnv to ensure that tools like sqlfluff are found via the current nix environment.