173 lines
5.9 KiB
Nix
173 lines
5.9 KiB
Nix
{ lib, pkgs, ... }:
|
||
let
|
||
quoteValues = ini: lib.mapAttrs
|
||
(_: attrs:
|
||
lib.mapAttrs (_: value: if builtins.isString value then ''"${value}"'' else value) attrs
|
||
)
|
||
ini;
|
||
|
||
solarized = import ../solarized.nix;
|
||
|
||
config = {
|
||
main = {
|
||
# Enables context sensitive auto-completion. If this is disabled the all
|
||
# possible completions will be listed.
|
||
smart_completion = true;
|
||
|
||
# Multi-line mode allows breaking up the sql statements into multiple lines. If
|
||
# this is set to True, then the end of the statements must have a semi-colon.
|
||
# If this is set to False then sql statements can't be split into multiple
|
||
# lines. End of line (return) is considered as the end of the statement.
|
||
multi_line = false;
|
||
|
||
# Destructive warning mode will alert you before executing a sql statement
|
||
# that may cause harm to the database such as "drop table", "drop database"
|
||
# or "shutdown".
|
||
destructive_warning = true;
|
||
|
||
# log_file location.
|
||
log_file = "~/.mycli.log";
|
||
|
||
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
|
||
# and "DEBUG". "NONE" disables logging.
|
||
log_level = "INFO";
|
||
|
||
# Log every query and its results to a file. Enable this by uncommenting the
|
||
# line below.
|
||
# audit_log = "~/.mycli-audit.log";
|
||
|
||
# Timing of sql statments and table rendering.
|
||
timing = true;
|
||
|
||
# Table format. Possible values: ascii, double, github,
|
||
# psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html,
|
||
# latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv.
|
||
# Recommended: ascii
|
||
table_format = "pipe";
|
||
|
||
# Syntax coloring style. Possible values (many support the "-dark" suffix):
|
||
# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs,
|
||
# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default,
|
||
# fruity.
|
||
# Screenshots at http://mycli.net/syntax
|
||
# Can be further modified in [colors]
|
||
syntax_style = "native";
|
||
|
||
# Keybindings: Possible values: emacs, vi.
|
||
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
|
||
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
|
||
key_bindings = "emacs";
|
||
|
||
# Enabling this option will show the suggestions in a wider menu. Thus more items are suggested.
|
||
wider_completion_menu = false;
|
||
|
||
# MySQL prompt
|
||
# \D - The full current date
|
||
# \d - Database name
|
||
# \h - Hostname of the server
|
||
# \m - Minutes of the current time
|
||
# \n - Newline
|
||
# \P - AM/PM
|
||
# \p - Port
|
||
# \R - The current time, in 24-hour military time (0–23)
|
||
# \r - The current time, standard 12-hour time (1–12)
|
||
# \s - Seconds of the current time
|
||
# \t - Product type (Percona, MySQL, MariaDB)
|
||
# \A - DSN alias name (from the [alias_dsn] section)
|
||
# \u - Username
|
||
# \x1b[...m - insert ANSI escape sequence
|
||
prompt = "\\u@\\A:\\d> ";
|
||
prompt_continuation = "-> ";
|
||
|
||
# Skip intro info on startup and outro info on exit
|
||
less_chatty = false;
|
||
|
||
# Use alias from --login-path instead of host name in prompt
|
||
login_path_as_host = false;
|
||
|
||
# Cause result sets to be displayed vertically if they are too wide for the current window,
|
||
# and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.)
|
||
auto_vertical_output = false;
|
||
|
||
# keyword casing preference. Possible values "lower", "upper", "auto"
|
||
keyword_casing = "upper";
|
||
|
||
# disabled pager on startup
|
||
enable_pager = true;
|
||
};
|
||
# Favorite queries.
|
||
favorite_queries = { };
|
||
|
||
# Use the -d option to reference a DSN.
|
||
# Special characters in passwords and other strings can be escaped with URL encoding.
|
||
alias_dsn = {
|
||
# example_dsn = "mysql://[user[:password]@][host][:port][/dbname]";
|
||
};
|
||
};
|
||
|
||
colors =
|
||
let
|
||
c = solarized.colors;
|
||
in
|
||
{
|
||
common = {
|
||
"output.header" = "bold ${c.green}";
|
||
"sql.datatype" = "nobold ${c.yellow}";
|
||
"sql.function" = "bold ${c.violet}";
|
||
"sql.keyword" = c.green;
|
||
"sql.literal" = c.green;
|
||
"sql.number" = c.cyan;
|
||
"sql.string" = c.cyan;
|
||
"sql.variable" = c.red;
|
||
"sql.quoted-schema-object" = c.blue;
|
||
};
|
||
light = {
|
||
"prompt" = "bg:${c.blue} ${c.base02}";
|
||
"selected" = "bg:${c.base2} ${c.base00}";
|
||
"output.odd-row" = "${c.base01}";
|
||
"output.even-row" = "${c.base01} bg:${c.base2}";
|
||
"sql.comment" = "italic ${c.base1}";
|
||
"sql.operator" = "bold ${c.base02}";
|
||
"sql.punctuation" = "bold ${c.base01}";
|
||
"sql.symbol" = "${c.base01}";
|
||
};
|
||
dark = {
|
||
"prompt" = "bg:${c.blue} ${c.base2}";
|
||
"selected" = "bg:${c.base02} ${c.base0}";
|
||
"output.odd-row" = "${c.base1}";
|
||
"output.even-row" = "${c.base1} bg:${c.base02}";
|
||
"sql.comment" = "italic ${c.base01}";
|
||
"sql.operator" = "bold ${c.base2}";
|
||
"sql.punctuation" = "bold ${c.base1}";
|
||
"sql.symbol" = "${c.base1}";
|
||
};
|
||
};
|
||
in
|
||
{
|
||
home.packages = [
|
||
(pkgs.mycli.overridePythonAttrs (old: {
|
||
dependencies = old.dependencies ++ [ pkgs.python3Packages.sshtunnel ];
|
||
}))
|
||
(pkgs.stdenv.mkDerivation {
|
||
name = "myssh";
|
||
propagatedBuildInputs = [
|
||
(pkgs.python3.withPackages (pp: with pp; [
|
||
pyyaml
|
||
]))
|
||
];
|
||
dontUnpack = true;
|
||
installPhase = "install -Dm755 ${./myssh.py} $out/bin/myssh";
|
||
})
|
||
];
|
||
|
||
xdg.configFile = lib.attrsets.mapAttrs'
|
||
(
|
||
name: value: lib.attrsets.nameValuePair "mycli/theme-${name}.ini" {
|
||
text = lib.generators.toINI { } (quoteValues (config // { colors = value; }));
|
||
}
|
||
)
|
||
{
|
||
light = colors.common // colors.light;
|
||
dark = colors.common // colors.dark;
|
||
};
|
||
}
|