summaryrefslogtreecommitdiff
path: root/modules/common/profiles/dev/sql.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-02-19 17:50:35 +0300
committerAzat Bahawi <azat@bahawi.net>2023-02-19 17:50:35 +0300
commit91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 (patch)
treee07291fcb1cf62a561ffe58d1fd8e2968ff6fcb3 /modules/common/profiles/dev/sql.nix
parentf1e8dc736a904703eaa97ccf3d5cde3f69101c38 (diff)
2023-02-19
Diffstat (limited to 'modules/common/profiles/dev/sql.nix')
-rw-r--r--modules/common/profiles/dev/sql.nix101
1 files changed, 101 insertions, 0 deletions
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";
+ };
+ }
+ ]);
+ };
+ };
+ };
+}