fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
1.0 KiB47 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.programs.sqls;
8
9  yamlFormat = pkgs.formats.yaml { };
10
11in {
12  meta.maintainers = [ ];
13
14  options.programs.sqls = {
15    enable = mkEnableOption "sqls, a SQL language server written in Go";
16
17    settings = mkOption {
18      type = yamlFormat.type;
19      default = { };
20      example = literalExpression ''
21        {
22           lowercaseKeywords = true;
23           connections = [
24             {
25               driver = "mysql";
26               dataSourceName = "root:root@tcp(127.0.0.1:13306)/world";
27             }
28           ];
29        }
30      '';
31      description = ''
32        Configuration written to
33        {file}`$XDG_CONFIG_HOME/sqls/config.yml`. See
34        <https://github.com/lighttiger2505/sqls#db-configuration>
35        for supported values.
36      '';
37    };
38  };
39
40  config = mkIf cfg.enable {
41    home.packages = [ pkgs.sqls ];
42
43    xdg.configFile."sqls/config.yml" = mkIf (cfg.settings != { }) {
44      source = yamlFormat.generate "sqls-config" cfg.settings;
45    };
46  };
47}