From 9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 31 Mar 2024 21:29:27 +0300 Subject: 2024-03-31 --- modules/common/profiles/default.nix | 6 +- modules/common/profiles/dev/containers.nix | 6 +- modules/common/profiles/dev/default.nix | 9 +- modules/common/profiles/dev/sql.nix | 151 +++++++++++++++-------------- modules/common/profiles/email.nix | 142 ++++++++++++++------------- modules/common/profiles/headful.nix | 11 ++- modules/common/profiles/headless.nix | 16 +-- 7 files changed, 184 insertions(+), 157 deletions(-) (limited to 'modules/common/profiles') diff --git a/modules/common/profiles/default.nix b/modules/common/profiles/default.nix index a17ff08..79ce39d 100644 --- a/modules/common/profiles/default.nix +++ b/modules/common/profiles/default.nix @@ -5,9 +5,11 @@ this, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.default; -in { +in +{ imports = [ ./dev ./email.nix diff --git a/modules/common/profiles/dev/containers.nix b/modules/common/profiles/dev/containers.nix index e90c88e..8f3bfc6 100644 --- a/modules/common/profiles/dev/containers.nix +++ b/modules/common/profiles/dev/containers.nix @@ -4,9 +4,11 @@ pkgs, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.dev.containers; -in { +in +{ options.nixfiles.modules.profiles.dev.containers.enable = mkEnableOption "Tools for working with containers and container orchestration" // { diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix index 52dc49f..6ac1fe6 100644 --- a/modules/common/profiles/dev/default.nix +++ b/modules/common/profiles/dev/default.nix @@ -4,17 +4,18 @@ pkgs, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.dev; -in { +in +{ imports = [ ./containers.nix ./hidden.nix ./sql.nix ]; - options.nixfiles.modules.profiles.dev.enable = - mkEnableOption "Catch-all profile for stuff related to software development and etc."; + options.nixfiles.modules.profiles.dev.enable = mkEnableOption "Catch-all profile for stuff related to software development and etc."; config = mkIf cfg.enable { nixfiles.modules = { diff --git a/modules/common/profiles/dev/sql.nix b/modules/common/profiles/dev/sql.nix index 3e1c4b2..c2d4894 100644 --- a/modules/common/profiles/dev/sql.nix +++ b/modules/common/profiles/dev/sql.nix @@ -4,9 +4,11 @@ pkgs, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.dev.sql; -in { +in +{ options.nixfiles.modules.profiles.dev.sql.enable = mkEnableOption "SQL stuff and database management tools" // { @@ -20,81 +22,84 @@ in { 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"; - }; + 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.colors.withHashtag; { - "arg-toolbar" = "noinherit bold"; - "arg-toolbar.text" = "nobold"; - "bottom-toolbar" = "bg:${base01} ${base06}"; - "bottom-toolbar.off" = "bg:${base01} ${base02}"; - "bottom-toolbar.on" = "bg:${base01} ${base07}"; - "bottom-toolbar.transaction.failed" = "bg:${base01} ${base08} bold"; - "bottom-toolbar.transaction.valid" = "bg:${base01} ${base0B} bold"; - "completion-menu.completion" = "bg:${base01} ${base06}"; - "completion-menu.completion.current" = "bg:${base06} ${base01}"; - "completion-menu.meta.completion" = "bg:${base01} ${base13}"; - "completion-menu.meta.completion.current" = "bg:${base09} ${base01}"; - "completion-menu.multi-column-meta" = "bg:${base09} ${base01}"; - "scrollbar" = "bg:${base01}"; - "scrollbar.arrow" = "bg:${base01}"; - "search" = "bg:${base17} ${base07}"; - "search-toolbar" = "noinherit bold"; - "search-toolbar.text" = "nobold"; - "search.current" = "bg:${base14} ${base07}"; - "selected" = "bg:${base0D} ${base07}"; - "system-toolbar" = "noinherit bold"; - }; + colorsSection = with config.colors.withHashtag; { + "arg-toolbar" = "noinherit bold"; + "arg-toolbar.text" = "nobold"; + "bottom-toolbar" = "bg:${base01} ${base06}"; + "bottom-toolbar.off" = "bg:${base01} ${base02}"; + "bottom-toolbar.on" = "bg:${base01} ${base07}"; + "bottom-toolbar.transaction.failed" = "bg:${base01} ${base08} bold"; + "bottom-toolbar.transaction.valid" = "bg:${base01} ${base0B} bold"; + "completion-menu.completion" = "bg:${base01} ${base06}"; + "completion-menu.completion.current" = "bg:${base06} ${base01}"; + "completion-menu.meta.completion" = "bg:${base01} ${base13}"; + "completion-menu.meta.completion.current" = "bg:${base09} ${base01}"; + "completion-menu.multi-column-meta" = "bg:${base09} ${base01}"; + "scrollbar" = "bg:${base01}"; + "scrollbar.arrow" = "bg:${base01}"; + "search" = "bg:${base17} ${base07}"; + "search-toolbar" = "noinherit bold"; + "search-toolbar.text" = "nobold"; + "search.current" = "bg:${base14} ${base07}"; + "selected" = "bg:${base0D} ${base07}"; + "system-toolbar" = "noinherit bold"; + }; - mkCliConfig = { - name, - custom, - }: { - "${name}/config" = { - text = generators.toINI {} { - main = mainSection // custom; - colors = mapAttrs (_: v: "'${v}'") colorsSection; + mkCliConfig = + { name, custom }: + { + "${name}/config" = { + text = generators.toINI { } { + main = mainSection // custom; + colors = mapAttrs (_: v: "'${v}'") colorsSection; + }; + }; }; - }; + in + { + configFile = mkMerge ( + map mkCliConfig [ + { + name = "pgcli"; + custom = { + prompt = "'\\u@\\h:\\d> '"; + multi_line_mode = "psql"; + on_error = "STOP"; + auto_expand = "True"; + expand = "True"; + keyring = "False"; + vi = "True"; + casing_file = "/dev/null"; + history_file = "/dev/null"; + }; + } + { + name = "litecli"; + custom = { + prompt = "'\\d> '"; + prompt_continuation = "'-> '"; + auto_vertical_output = "True"; + key_bindings = "vi"; + audit_log = "/dev/null"; + }; + } + ] + ); }; - in { - configFile = mkMerge (map mkCliConfig [ - { - name = "pgcli"; - custom = { - prompt = "'\\u@\\h:\\d> '"; - multi_line_mode = "psql"; - on_error = "STOP"; - auto_expand = "True"; - expand = "True"; - keyring = "False"; - vi = "True"; - casing_file = "/dev/null"; - history_file = "/dev/null"; - }; - } - { - name = "litecli"; - custom = { - prompt = "'\\d> '"; - prompt_continuation = "'-> '"; - auto_vertical_output = "True"; - key_bindings = "vi"; - audit_log = "/dev/null"; - }; - } - ]); - }; }; }; } diff --git a/modules/common/profiles/email.nix b/modules/common/profiles/email.nix index 3c809af..a525692 100644 --- a/modules/common/profiles/email.nix +++ b/modules/common/profiles/email.nix @@ -5,45 +5,51 @@ this, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.email; -in { - options.nixfiles.modules.profiles.email.enable = - mkEnableOption "Local Email management" // {default = this.isHeadful;}; +in +{ + options.nixfiles.modules.profiles.email.enable = mkEnableOption "Local Email management" // { + default = this.isHeadful; + }; config = mkIf cfg.enable { hm = { accounts.email = { maildirBasePath = "${config.my.home}/doc/mail"; - accounts = let - mkAccount = attrs: - mkMerge [ - { - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = ["*"]; - }; - msmtp.enable = true; - mu.enable = true; - thunderbird = { - enable = hasSuffix "linux" this.system; - settings = id: { - "mail.identity.id_${id}.compose_html" = false; - "mail.identity.id_${id}.reply_on_top" = 0; + accounts = + let + mkAccount = + attrs: + mkMerge [ + { + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + patterns = [ "*" ]; }; - }; - } - attrs - ]; + msmtp.enable = true; + mu.enable = true; + thunderbird = { + enable = hasSuffix "linux" this.system; + settings = id: { + "mail.identity.id_${id}.compose_html" = false; + "mail.identity.id_${id}.reply_on_top" = 0; + }; + }; + } + attrs + ]; - getPassword = { - path, - line ? 0, - }: - assert (builtins.isInt line); + getPassword = + { + path, + line ? 0, + }: + assert (builtins.isInt line); concatStringsSep " " ( [ (getExe config.hm.programs.password-store.package) @@ -57,48 +63,54 @@ in { "'${toString line}!d'" ] ); - in { - shire = mkAccount rec { - address = my.email; - aliases = [address "frodo@rohan.net" "azahi@shire.net"]; - realName = my.fullname; - gpg = { - inherit (my.pgp) key; - signByDefault = true; - encryptByDefault = false; - }; + in + { + shire = mkAccount rec { + address = my.email; + aliases = [ + address + "frodo@rohan.net" + "azahi@shire.net" + ]; + realName = my.fullname; + gpg = { + inherit (my.pgp) key; + signByDefault = true; + encryptByDefault = false; + }; - primary = true; + primary = true; - imap = { - host = "shire.net"; - port = 993; - tls.enable = true; - }; - smtp = { - host = "shire.net"; - port = 465; - tls.enable = true; + imap = { + host = "shire.net"; + port = 993; + tls.enable = true; + }; + smtp = { + host = "shire.net"; + port = 465; + tls.enable = true; + }; + userName = "azahi@shire.net"; + passwordCommand = getPassword { path = "email/shire.net/azahi"; }; }; - userName = "azahi@shire.net"; - passwordCommand = getPassword { - path = "email/shire.net/azahi"; - }; - }; - yahoo = mkAccount rec { - address = "admin@yahoo.com"; - aliases = [address "admin@yahoo.com"]; - realName = "Firstname Lastname"; + yahoo = mkAccount rec { + address = "admin@yahoo.com"; + aliases = [ + address + "admin@yahoo.com" + ]; + realName = "Firstname Lastname"; - flavor = "yahoo.com"; - userName = "admin@yahoo.com"; - passwordCommand = getPassword { - path = "email/yahoo.com/admin"; - line = 2; + flavor = "yahoo.com"; + userName = "admin@yahoo.com"; + passwordCommand = getPassword { + path = "email/yahoo.com/admin"; + line = 2; + }; }; }; - }; }; programs = { diff --git a/modules/common/profiles/headful.nix b/modules/common/profiles/headful.nix index 1578ccc..cd29225 100644 --- a/modules/common/profiles/headful.nix +++ b/modules/common/profiles/headful.nix @@ -5,11 +5,14 @@ this, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.headful; -in { - options.nixfiles.modules.profiles.headful.enable = - mkEnableOption "headful profile" // {default = this.isHeadful;}; +in +{ + options.nixfiles.modules.profiles.headful.enable = mkEnableOption "headful profile" // { + default = this.isHeadful; + }; config = mkIf cfg.enable { nixfiles.modules = { diff --git a/modules/common/profiles/headless.nix b/modules/common/profiles/headless.nix index cc7c326..1f8096c 100644 --- a/modules/common/profiles/headless.nix +++ b/modules/common/profiles/headless.nix @@ -5,19 +5,21 @@ this, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.headless; -in { - options.nixfiles.modules.profiles.headless.enable = - mkEnableOption "headless profile" // {default = this.isHeadless;}; +in +{ + options.nixfiles.modules.profiles.headless.enable = mkEnableOption "headless profile" // { + default = this.isHeadless; + }; config = mkIf cfg.enable { hm.home.file = { ".hushlogin".text = ""; - ".bash_history".source = - config.hm.lib.file.mkOutOfStoreSymlink "/dev/null"; + ".bash_history".source = config.hm.lib.file.mkOutOfStoreSymlink "/dev/null"; }; - environment.systemPackages = with pkgs; [alacritty.terminfo]; + environment.systemPackages = with pkgs; [ alacritty.terminfo ]; }; } -- cgit 1.4.1