From 5e6dd8c2b8dd4e6f396fd4f9fc9222bf88486d1f Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Tue, 10 May 2022 23:45:50 -0400 Subject: [PATCH] mail config and firefox container tabs --- flake.nix | 1 + hosts/desktop/default.nix | 1 + modules/applications/firefox.nix | 10 +++- modules/desktop/polybar.nix | 2 +- modules/mail/himalaya.nix | 96 ++++++++++++++++++++++++-------- modules/services/gnupg.nix | 3 +- modules/system/user.nix | 11 +++- 7 files changed, 96 insertions(+), 28 deletions(-) diff --git a/flake.nix b/flake.nix index e4b27fe..b806ce5 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,7 @@ passwordHash = "$6$J15o3OLElCEncVB3$0FW.R7YFBMgtBp320kkZO.TdKvYDLHmnP6dgktdrVYCC3LUvzXj0Fj0elR/fXo9geYwwWi.EAHflCngL5T.3g/"; gitEmail = "7386960+nmasur@users.noreply.github.com"; + mailServer = "noahmasur.com"; gui = { colorscheme = (import ./modules/colorscheme/gruvbox); wallpaper = ../../../downloads/nix.jpg; diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index 03d26b7..e76e56f 100644 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -19,6 +19,7 @@ nixpkgs.lib.nixosSystem { ../../modules/desktop ../../modules/shell ../../modules/gaming + ../../modules/mail/himalaya.nix ../../modules/services/keybase.nix ../../modules/services/gnupg.nix ../../modules/applications/firefox.nix diff --git a/modules/applications/firefox.nix b/modules/applications/firefox.nix index 91642af..dc09ca7 100644 --- a/modules/applications/firefox.nix +++ b/modules/applications/firefox.nix @@ -38,12 +38,13 @@ "extensions.pocket.enabled" = false; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css + "layout.css.color-mix.enabled" = true; }; userChrome = '' :root { --focus-outline-color: ${config.gui.colorscheme.base04} !important; --toolbar-color: ${config.gui.colorscheme.base07} !important; - --tab-min-height: 20px !important; + --tab-min-height: 30px !important; } /* Background of tab bar */ .toolbar-items { @@ -53,12 +54,17 @@ .tabbrowser-tab .tab-stack { border-radius: 5px 5px 0 0; overflow: hidden; + background-color: ${config.gui.colorscheme.base00}; + color: ${config.gui.colorscheme.base06} !important; } .tab-content { - background-color: ${config.gui.colorscheme.base00} !important; + border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 40%, transparent); + border-radius: 5px 5px 0 0; + background-color: ${config.gui.colorscheme.base00}; color: ${config.gui.colorscheme.base06} !important; } .tab-content[selected=true] { + border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent); background-color: ${config.gui.colorscheme.base01} !important; color: ${config.gui.colorscheme.base07} !important; } diff --git a/modules/desktop/polybar.nix b/modules/desktop/polybar.nix index 20f16ac..cfba90e 100644 --- a/modules/desktop/polybar.nix +++ b/modules/desktop/polybar.nix @@ -158,7 +158,7 @@ "module/date" = { type = "internal/date"; interval = 1; - date = "%l:%M %p"; + date = "%d %b %l:%M %p"; date-alt = "%Y-%m-%d %H:%M:%S"; label = "%date%"; label-foreground = config.gui.colorscheme.base0A; diff --git a/modules/mail/himalaya.nix b/modules/mail/himalaya.nix index 43c9139..f791b00 100644 --- a/modules/mail/himalaya.nix +++ b/modules/mail/himalaya.nix @@ -1,27 +1,77 @@ -{ pkgs, lib, user, ... }: { +{ config, pkgs, lib, ... }: { - home-manager.users.${user} = { - - home.packages = with pkgs; [ himalaya ]; - - programs.himalaya = { - enable = true; - settings = { - name = "${name}"; - downloads-dir = "~/Downloads"; - home = { - default = true; - email = "censored"; - imap-host = "censored"; - imap-port = 993; - imap-login = "censored"; - imap-passwd-cmd = "cat ~/.config/himalaya/passwd"; - smtp-host = "censored"; - smtp-port = 587; - smtp-login = "censored"; - smtp-passwd-cmd = "cat ~/.config/himalaya/passwd"; - }; - }; + options = { + mailServer = lib.mkOption { + type = lib.types.str; + description = "Server name for the email address."; }; }; + + config = { + + home-manager.users.${config.user} = { + + programs.himalaya = { enable = true; }; + + accounts.email = { + maildirBasePath = "/home/${config.user}/mail"; + accounts = { + main = let + address = "${config.user}@${config.mailServer}"; + serverHostname = "mail.${config.mailServer}"; + in { + userName = address; + realName = config.fullName; + primary = true; + inherit address; + aliases = map (mailUser: "${mailUser}@${config.mailServer}") [ + "me" + "hey" + "admin" + ]; + alot = { }; + flavor = "plain"; + folders = { }; + getmail = { }; + himalaya = { + enable = true; + settings = { downloads-dir = config.userDirs.download; }; + }; + imap = { + host = serverHostname; + port = 993; + tls.enable = true; + }; + imapnotify = { + enable = false; + boxes = [ ]; + onNotify = ""; + onNotifyPost = ""; + }; + maildir = { path = "main"; }; + mbsync = { + enable = false; + create = "maildir"; + expunge = "none"; + remove = "none"; + patterns = [ "*" ]; + }; + mu.enable = false; + notmuch.enable = false; + passwordCommand = + "cat /home/${config.user}/.config/himalaya/passwd"; + smtp = { + host = serverHostname; + port = 587; + tls.enable = true; + }; + }; + }; + }; + + programs.fish.shellAbbrs = { hi = "himalaya"; }; + + }; + + }; } diff --git a/modules/services/gnupg.nix b/modules/services/gnupg.nix index 2649f62..99939cb 100644 --- a/modules/services/gnupg.nix +++ b/modules/services/gnupg.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{ config, pkgs, ... }: { home-manager.users.${config.user} = { programs.gpg.enable = true; @@ -10,6 +10,7 @@ maxCacheTtlSsh = 34560000; # Can never reset pinentryFlavor = "tty"; }; + home.packages = with pkgs; [ pinentry ]; }; } diff --git a/modules/system/user.nix b/modules/system/user.nix index 8898969..fea06e1 100644 --- a/modules/system/user.nix +++ b/modules/system/user.nix @@ -13,6 +13,15 @@ description = "Password created with mkpasswd -m sha-512"; }; + userDirs = { + # Required to prevent infinite recursion with himalaya + download = lib.mkOption { + type = lib.types.str; + description = "XDG directory for downloads"; + default = "$HOME/downloads"; + }; + }; + }; config = { @@ -37,7 +46,7 @@ enable = true; createDirectories = true; documents = "$HOME/documents"; - download = "$HOME/downloads"; + download = config.userDirs.download; music = "$HOME/media/music"; pictures = "$HOME/media/images"; videos = "$HOME/media/videos";