From b868436756b7583988d370a839e3e07c7d9be842 Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Fri, 6 Sep 2024 16:08:36 -0400 Subject: [PATCH] email and stuff --- hosts/macbook/configuration.nix | 1 + hosts/macbook/home.nix | 2 + .../home-manager/email/calendar-password.sh | 2 - modules/home-manager/email/default.nix | 119 +++++++----------- .../email/work-calendar-client-id.sh | 2 - .../email/work-calendar-client-secret.sh | 2 - modules/home-manager/keepassxc/default.nix | 9 ++ modules/home-manager/neovim/nvim/init.lua | 4 + .../neovim/nvim/lua/plugins/lsp.lua | 118 +++-------------- .../neovim/nvim/lua/plugins/mini.lua | 8 +- .../home-manager/password-store/default.nix | 27 ++++ modules/home-manager/tmux/default.nix | 15 ++- modules/home-manager/zsh/default.nix | 7 +- modules/nixos/user.nix | 4 +- 14 files changed, 123 insertions(+), 197 deletions(-) delete mode 100755 modules/home-manager/email/calendar-password.sh delete mode 100755 modules/home-manager/email/work-calendar-client-id.sh delete mode 100755 modules/home-manager/email/work-calendar-client-secret.sh create mode 100644 modules/home-manager/keepassxc/default.nix create mode 100644 modules/home-manager/password-store/default.nix diff --git a/hosts/macbook/configuration.nix b/hosts/macbook/configuration.nix index dd241e9..2271605 100644 --- a/hosts/macbook/configuration.nix +++ b/hosts/macbook/configuration.nix @@ -56,6 +56,7 @@ mthomson = import ./home.nix; }; }; + programs.zsh.enable = true; # Auto upgrade nix package and the daemon service. diff --git a/hosts/macbook/home.nix b/hosts/macbook/home.nix index 84afae8..4fe3d56 100644 --- a/hosts/macbook/home.nix +++ b/hosts/macbook/home.nix @@ -11,6 +11,7 @@ ../../modules/home-manager/eza ../../modules/home-manager/bat ../../modules/home-manager/irssi ../../modules/home-manager/email + ../../modules/home-manager/password-store ]; home.username = "mthomson"; home.homeDirectory = "/Users/mthomson"; @@ -58,6 +59,7 @@ calcurse glow gcc + keepassxc luajit ]; diff --git a/modules/home-manager/email/calendar-password.sh b/modules/home-manager/email/calendar-password.sh deleted file mode 100755 index 6a7ecb1..0000000 --- a/modules/home-manager/email/calendar-password.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -op read op://Personal/Baikal/password diff --git a/modules/home-manager/email/default.nix b/modules/home-manager/email/default.nix index b75e1fa..65065ec 100644 --- a/modules/home-manager/email/default.nix +++ b/modules/home-manager/email/default.nix @@ -5,17 +5,11 @@ w3m ]; - home.file = { - "calendar-password.sh" = { - source = ./calendar-password.sh; - executable = true; - }; - }; - services = { # mbsync = { # enable = true; # frequency = "*-*-* *:*/5:00"; + # postExec = "\${pkgs.notmuch} new"; # }; vdirsyncer = { enable = true; @@ -26,67 +20,12 @@ programs = { aerc = { enable = true; - stylesets = { - catppuccin-frappe = '' - *.default=true - *.normal=true - - default.fg=#c6d0f5 - - error.fg=#e78284 - warning.fg=#ef9f76 - success.fg=#a6d189 - - tab.fg=#737994 - tab.bg=#292c3c - tab.selected.fg=#c6d0f5 - tab.selected.bg=#303446 - tab.selected.bold=true - - border.fg=#232634 - border.bold=true - - msglist_unread.bold=true - msglist_flagged.fg=#e5c890 - msglist_flagged.bold=true - msglist_result.fg=#8caaee - msglist_result.bold=true - msglist_*.selected.bold=true - msglist_*.selected.bg=#414559 - - dirlist_*.selected.bold=true - dirlist_*.selected.bg=#414559 - - statusline_default.fg=#949cbb - statusline_default.bg=#414559 - statusline_error.bold=true - statusline_success.bold=true - - completion_default.selected.bg=#414559 - - [viewer] - url.fg=#8caaee - url.underline=true - header.bold=true - signature.dim=true - diff_meta.bold=true - diff_chunk.fg=#8caaee - diff_chunk_func.fg=#8caaee - diff_chunk_func.bold=true - diff_add.fg=#a6d189 - diff_del.fg=#e78284 - quote_*.fg=#737994 - quote_1.fg=#949cbb - ''; - }; extraConfig = { general = { unsafe-accounts-conf = true; }; - ui = { - border-char-vertical = "│"; - border-char-horizontal = "─"; - styleset-name = "catppuccin-frappe"; + compose = { + address-book-cmd = "khard email --parsable --remove-first-line %s"; }; filters = { "text/plain" = "colorize"; @@ -112,11 +51,9 @@ }; khal = { enable = true; - settings = { - view = { - agenda_event_format = "{calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{reset}"; - }; - }; + }; + khard = { + enable = true; }; }; @@ -127,7 +64,7 @@ address = "michael@michaelthomson.dev"; realName = "Michael Thomson"; userName = "michael@michaelthomson.dev"; - passwordCommand = "${pkgs._1password}/bin/op read \"op://Personal/SES SMTP/password\""; + passwordCommand = "pass email/michael@michaelthomson.dev"; aerc = { enable = true; }; @@ -167,13 +104,9 @@ url = "https://baikal.michaelthomson.dev/dav.php"; userName = "michael@michaelthomson.dev"; passwordCommand = [ - "~/calendar-password.sh" + "pass" + "calendar/michael@michaelthomson.dev" ]; - # passwordCommand = [ - # "${pkgs._1password}/bin/op" - # "read" - # "op://Personal/Baikal/password" - # ]; }; vdirsyncer = { enable = true; @@ -182,8 +115,40 @@ }; khal = { enable = true; + addresses = [ "michael@michaelthomson.dev" ]; type = "discover"; - color = "#f2d5cf"; + }; + }; + }; + contact = { + basePath = ".contacts"; + accounts.personal = { + local = { + type = "filesystem"; + fileExt = ".vcf"; + }; + remote = { + type = "carddav"; + url = "https://baikal.michaelthomson.dev/dav.php"; + userName = "michael@michaelthomson.dev"; + passwordCommand = [ + "pass" + "calendar/michael@michaelthomson.dev" + ]; + }; + vdirsyncer = { + enable = true; + auth = "basic"; + collections = [ "default" ]; + }; + khal = { + enable = true; + addresses = [ "michael@michaelthomson.dev" ]; + collections = [ "default" ]; + }; + khard = { + enable = true; + defaultCollection = "default"; }; }; }; diff --git a/modules/home-manager/email/work-calendar-client-id.sh b/modules/home-manager/email/work-calendar-client-id.sh deleted file mode 100755 index e3cd7ea..0000000 --- a/modules/home-manager/email/work-calendar-client-id.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -op read "op://Employee/Work Email API OAuth/client id" --account konradgroup.1password.com diff --git a/modules/home-manager/email/work-calendar-client-secret.sh b/modules/home-manager/email/work-calendar-client-secret.sh deleted file mode 100755 index e4a95bc..0000000 --- a/modules/home-manager/email/work-calendar-client-secret.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -op read "op://Employee/Work Email API OAuth/client secret" --account konradgroup.1password.com diff --git a/modules/home-manager/keepassxc/default.nix b/modules/home-manager/keepassxc/default.nix new file mode 100644 index 0000000..6eedfde --- /dev/null +++ b/modules/home-manager/keepassxc/default.nix @@ -0,0 +1,9 @@ +{ pkgs, config, ... }: + +{ + home.packages = with pkgs; [ + keepassxc + ]; + + # home.sessionPath = [ "${pkgs.keepassxc}/Applications/KeePassXC.app/Contents/MacOS/" ]; +} diff --git a/modules/home-manager/neovim/nvim/init.lua b/modules/home-manager/neovim/nvim/init.lua index 4326a8b..db7ba12 100644 --- a/modules/home-manager/neovim/nvim/init.lua +++ b/modules/home-manager/neovim/nvim/init.lua @@ -17,6 +17,10 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) +vim.api.nvim_set_keymap("", "", "", { noremap = true, silent = true }) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + -- Setup lazy.nvim require("lazy").setup({ spec = { diff --git a/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua b/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua index 9c7968e..f2496b6 100644 --- a/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua +++ b/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua @@ -1,14 +1,4 @@ return { - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - { path = 'luvit-meta/library', words = { 'vim%.uv' } }, - }, - }, - }, - { 'Bilal2453/luvit-meta', lazy = true }, { 'neovim/nvim-lspconfig', cmd = 'LspInfo', @@ -35,20 +25,26 @@ return { end }) - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + vim.api.nvim_create_autocmd({ "VimEnter" }, { + callback = function() + local clients = vim.lsp.get_clients() + for _, client in ipairs(clients) do + local id = client.id + vim.lsp.completion.enable(true, id, 1, { autotrigger = true }) + return + end + end, + }) -- Server configs local lsp = require('lspconfig') -- vue lsp.volar.setup({ - capabilities = capabilities, }) -- typescript / javascript require'lspconfig'.ts_ls.setup{ - capabilities = capabilities, init_options = { plugins = { { @@ -63,121 +59,35 @@ return { -- eslint lsp.eslint.setup({ - capabilities = capabilities, }) -- tailwind lsp.tailwindcss.setup({ - capabilities = capabilities, root_dir = lsp.util.root_pattern('tailwind.config.js', 'tailwind.config.cjs', 'tailwind.config.mjs', 'tailwind.config.ts') }) -- html lsp.html.setup({ - capabilities = capabilities, }) -- go lsp.gopls.setup({ - capabilities = capabilities, settings = { gopls = { - usePlaceholders = true, + completeFunctionCalls = false, } } }) lsp.golangci_lint_ls.setup({ - capabilities = capabilities, }) -- templ vim.filetype.add({ extension = { templ = "templ" } }) - lsp.templ.setup({ - capabilities = capabilities, - }) + lsp.templ.setup({}) - lsp.lua_ls.setup({ - capabilities = capabilities, - }) + lsp.lua_ls.setup({}) - lsp.nil_ls.setup({ - capabilities = capabilities, - }) + lsp.nil_ls.setup({}) end, }, - { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', - dependencies = { - { - 'L3MON4D3/LuaSnip', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - { - 'rafamadriz/friendly-snippets', - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - }, - }, - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.confirm { select = true }, - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), - }, - sources = { - { - name = 'lazydev', - -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it - group_index = 0, - }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - end, - }, - { - 'nvim-tree/nvim-web-devicons', - } } diff --git a/modules/home-manager/neovim/nvim/lua/plugins/mini.lua b/modules/home-manager/neovim/nvim/lua/plugins/mini.lua index 21699ba..19e608c 100644 --- a/modules/home-manager/neovim/nvim/lua/plugins/mini.lua +++ b/modules/home-manager/neovim/nvim/lua/plugins/mini.lua @@ -24,9 +24,9 @@ return { -- Collection of various small independent plugins/modules require('mini.comment').setup() - -- local icons = require('mini.icons') - -- icons.setup() - -- icons.tweak_lsp_kind() + local icons = require('mini.icons') + icons.setup() + icons.tweak_lsp_kind() require('mini.indentscope').setup({ draw = { @@ -107,7 +107,7 @@ return { -- Collection of various small independent plugins/modules -- saturation = 'high' -- }) - -- require('mini.completion').setup() + require('mini.completion').setup() require('mini.splitjoin').setup() diff --git a/modules/home-manager/password-store/default.nix b/modules/home-manager/password-store/default.nix new file mode 100644 index 0000000..780bd6a --- /dev/null +++ b/modules/home-manager/password-store/default.nix @@ -0,0 +1,27 @@ +{ pkgs, config, ... }: + +{ + + home.packages = with pkgs; [ + passExtensions.pass-otp + passExtensions.pass-file + ]; + + programs = { + gpg = { + enable = true; + }; + password-store = { + enable = true; + }; + browserpass = { + enable = true; + }; + }; + + # services = { + # gpg-agent = { + # enable = true; + # }; + # }; +} diff --git a/modules/home-manager/tmux/default.nix b/modules/home-manager/tmux/default.nix index db953e8..91ae620 100644 --- a/modules/home-manager/tmux/default.nix +++ b/modules/home-manager/tmux/default.nix @@ -15,7 +15,20 @@ set-option -sa terminal-overrides ",xterm*:Tc" set -s escape-time 0 set -g status-left-length 30 # could be any number - set -g status-style 'bg=#333333 fg=#5eacd3' + fg="#CBCCC6" + bg="#212732" + status_bg="#34455A" + border_fg="#70748C" + border_active_fg="#FECB6E" + status_left_bg="#FFA759" + + set -g status-style "bg=$status_bg,fg=$fg" + + set -g pane-border-style "bg=$bg,fg=$border_fg" + set -g pane-active-border-style "bg=$bg,fg=$border_active_fg" + + set -g window-status-current-style "fg=$border_active_fg" + set -g window-status-style "fg=$fg" ''; }; }; diff --git a/modules/home-manager/zsh/default.nix b/modules/home-manager/zsh/default.nix index 1057a9a..4f933ed 100644 --- a/modules/home-manager/zsh/default.nix +++ b/modules/home-manager/zsh/default.nix @@ -20,9 +20,10 @@ cdi = "zi"; cat = "bat"; }; - initExtra = '' - eval "$(/opt/homebrew/bin/brew shellenv)" - ''; + #initExtra = '' + #eval "$(/opt/homebrew/bin/brew shellenv)" + #. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh" + #''; }; starship = { enable = true; diff --git a/modules/nixos/user.nix b/modules/nixos/user.nix index e48ac51..4d1b0f6 100644 --- a/modules/nixos/user.nix +++ b/modules/nixos/user.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { - programs.zsh.enable = true; + #programs.zsh.enable = true; nix.settings = { trusted-users = ["mthomson"]; @@ -18,7 +18,7 @@ users.users.mthomson = { - shell = pkgs.zsh; + #shell = pkgs.zsh; isNormalUser = true; description = "Michael Thomson"; extraGroups = [ "networkmanager" "wheel" ];