-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathsqlfluff.nix
63 lines (59 loc) · 1.01 KB
/
sqlfluff.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
lib,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.sqlfluff;
# https://github.com/sqlfluff/sqlfluff/blob/main/README.md#dialects-supported
dialects = [
"db2"
"ansi"
"soql"
"tsql"
"hive"
"trino"
"mysql"
"oracle"
"sqlite"
"duckdb"
"exasol"
"athena"
"mariadb"
"vertica"
"teradata"
"redshift"
"sparksql"
"bigquery"
"postgres"
"greenplum"
"snowflake"
"materializ"
"clickhouse"
"databricks"
];
in
{
meta.maintainers = [ ];
imports = [
(mkFormatterModule {
name = "sqlfluff";
args = [ "format" ];
includes = [ "*.sql" ];
})
];
options.programs.sqlfluff = {
dialect = lib.mkOption {
description = "The sql dialect to use for formatting";
type = lib.types.enum dialects;
default = "ansi";
example = "sqlite";
};
};
config = lib.mkIf cfg.enable {
settings.formatter.sqlfluff = {
options = [ "--dialect=${cfg.dialect}" ];
};
};
}