From 91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 19 Feb 2023 17:50:35 +0300 Subject: 2023-02-19 --- modules/common/profiles/dev/sql.nix | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 modules/common/profiles/dev/sql.nix (limited to 'modules/common/profiles/dev/sql.nix') diff --git a/modules/common/profiles/dev/sql.nix b/modules/common/profiles/dev/sql.nix new file mode 100644 index 0000000..7a2a09c --- /dev/null +++ b/modules/common/profiles/dev/sql.nix @@ -0,0 +1,101 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.profiles.dev.sql; +in { + options.nixfiles.modules.profiles.dev.sql.enable = + mkEnableOption "SQL stuff and database management tools" + // { + default = config.nixfiles.modules.profiles.dev.default.enable; + }; + + config = mkIf cfg.enable { + hm = { + home.packages = with pkgs; [ + dbeaver + pgcli + litecli + ]; + + xdg = let + mainSection = { + destructive_warning = "True"; + enable_pager = "True"; + keyword_casing = "auto"; + less_chatty = "True"; + log_file = "/dev/null"; + log_level = "CRITICAL"; + multi_line = "False"; + syntax_style = "default"; + table_format = "fancy_grid"; + }; + + colorsSection = with config.colourScheme; { + "arg-toolbar" = "noinherit bold"; + "arg-toolbar.text" = "nobold"; + "bottom-toolbar" = "bg:${black} ${white}"; + "bottom-toolbar.off" = "bg:${black} ${brightBlack}"; + "bottom-toolbar.on" = "bg:${black} ${brightWhite}"; + "bottom-toolbar.transaction.failed" = "bg:${black} ${red} bold"; + "bottom-toolbar.transaction.valid" = "bg:${black} ${green} bold"; + "completion-menu.completion" = "bg:${black} ${white}"; + "completion-menu.completion.current" = "bg:${white} ${black}"; + "completion-menu.meta.completion" = "bg:${black} ${yellow}"; + "completion-menu.meta.completion.current" = "bg:${yellow} ${black}"; + "completion-menu.multi-column-meta" = "bg:${yellow} ${black}"; + "scrollbar" = "bg:${black}"; + "scrollbar.arrow" = "bg:${black}"; + "search" = "bg:${magenta} ${brightWhite}"; + "search-toolbar" = "noinherit bold"; + "search-toolbar.text" = "nobold"; + "search.current" = "bg:${green} ${brightWhite}"; + "selected" = "bg:${blue} ${brightWhite}"; + "system-toolbar" = "noinherit bold"; + }; + + mkCliConfig = { + name, + custom, + }: { + "${name}/config" = { + text = generators.toINI {} { + main = mainSection // custom; + colors = mapAttrs (_: v: "'${v}'") colorsSection; + }; + }; + }; + in { + configFile = mkMerge (map mkCliConfig [ + { + name = "pgcli"; + custom = { + auto_expand = "True"; + casing_file = "/dev/null"; + expand = "True"; + history_file = "/dev/null"; + keyring = "False"; + multi_line_mode = "psql"; + on_error = "STOP"; + prompt = "'\\u@\\h:\\d> '"; + vi = "True"; + }; + } + { + name = "litecli"; + custom = { + audit_log = "/dev/null"; + key_bindings = "vi"; + prompt = "'\\d> '"; + prompt_continuation = "'-> '"; + auto_vertical_output = "True"; + }; + } + ]); + }; + }; + }; +} -- cgit v1.2.3