2021-12-04 05:20:00 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.sqls;
|
|
|
|
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
|
|
|
|
in {
|
2023-06-22 10:16:28 +02:00
|
|
|
meta.maintainers = [ ];
|
2021-12-04 05:20:00 +01:00
|
|
|
|
|
|
|
options.programs.sqls = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "sqls, a SQL language server written in Go";
|
2021-12-04 05:20:00 +01:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
lowercaseKeywords = true;
|
|
|
|
connections = [
|
|
|
|
{
|
|
|
|
driver = "mysql";
|
|
|
|
dataSourceName = "root:root@tcp(127.0.0.1:13306)/world";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-12-04 05:20:00 +01:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/sqls/config.yml`. See
|
|
|
|
<https://github.com/lighttiger2505/sqls#db-configuration>
|
2021-12-04 05:20:00 +01:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ pkgs.sqls ];
|
|
|
|
|
|
|
|
xdg.configFile."sqls/config.yml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = yamlFormat.generate "sqls-config" cfg.settings;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|