From ecf2a0db9ffa24bc8c73238d779a8d36cd51d1cd Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Tue, 3 Sep 2024 23:02:26 -0600 Subject: [PATCH] Trying out nixvim and fish again. And other stuff --- home-cli.nix | 108 ++++++++++---------- home-gui.nix | 2 - home-mail.nix | 237 ++++++++++++++++++++++++-------------------- home-nvim.nix | 105 ++++++++++++++++++++ lazyvim-options.lua | 6 -- lazyvim-plugins.lua | 121 ---------------------- 6 files changed, 294 insertions(+), 285 deletions(-) create mode 100644 home-nvim.nix delete mode 100644 lazyvim-options.lua delete mode 100644 lazyvim-plugins.lua diff --git a/home-cli.nix b/home-cli.nix index 7388dc8..817f9a3 100644 --- a/home-cli.nix +++ b/home-cli.nix @@ -2,6 +2,7 @@ let secrets = import ./secrets.nix; + nixvim = import (builtins.fetchGit { url = "https://github.com/nix-community/nixvim"; }); in { home.stateVersion = "18.09"; @@ -9,8 +10,15 @@ in home.username = "dustinswan"; home.homeDirectory = "/Users/dustinswan"; + nix = { + package = pkgs.nix; + settings.experimental-features = [ "nix-command" "flakes" ]; + }; + imports = [ + nixvim.homeManagerModules.nixvim + ./home-nvim.nix ]; home.packages = with pkgs; [ @@ -21,7 +29,7 @@ in httpie ngrok ddev - bitwarden-cli + # bitwarden-cli mkcert gnupg rage @@ -38,6 +46,7 @@ in yarn php83 stack + cargo ruby # haskellPackages.ghcup php83Packages.composer @@ -70,6 +79,11 @@ in xdg.enable = true; + catppuccin = { + enable = true; + flavor = "mocha"; + }; + programs.home-manager.enable = true; programs.tmux = { @@ -97,19 +111,19 @@ in extraConfig = '' set -ag terminal-overrides ",xterm-256color:RGB" ''; - catppuccin.enable = true; }; programs.eza = { enable = true; enableZshIntegration = true; + enableFishIntegration = true; git = true; }; programs.zoxide = { - # z doc -> cd ~/Documents; zi -> interactive enable = true; enableZshIntegration = true; + enableFishIntegration = true; }; programs.zsh = { @@ -118,39 +132,57 @@ in syntaxHighlighting.enable = true; oh-my-zsh = { enable = true; - plugins = [ "git" "httpie" "aws" "fzf" "mosh" "npm" "rsync" "sudo" "yarn" "vi-mode" ]; + plugins = [ "git" "httpie" "aws" "mosh" "npm" "rsync" "sudo" "yarn" "vi-mode" ]; }; - syntaxHighlighting.catppuccin.enable = true; + }; + + programs.fish = { + enable = true; + plugins = [ + { + name = "plugin-git"; + src = pkgs.fishPlugins.plugin-git.src; + } + { + name = "foreign-env"; + src = pkgs.fetchFromGitHub { + owner = "oh-my-fish"; + repo = "plugin-foreign-env"; + rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc"; + sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"; + }; + } + ]; + + # https://codeberg.org/adamcstephens/dotfiles/src/commit/e14f35f6e9a9cb9174016948c512c0db364e0dec/apps/fish/init.fish + shellInit = '' + fenv source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish + source /nix/var/nix/profiles/default/etc/profile.d/nix.fish + ''; }; programs.direnv = { enable = true; enableZshIntegration = true; + # enableFishIntegration = true; }; programs.starship = { enable = true; enableZshIntegration = true; - catppuccin.enable = true; + enableFishIntegration = true; }; + # programs.skim = { + # enable = true; + # enableFishIntegration = true; + # enableZshIntegration = true; + # }; programs.fzf = { - # ctrl-t, ctrl-r, ssh ** enable = true; + enableFishIntegration = true; enableZshIntegration = true; - defaultCommand = "fd --type file --color=always"; - defaultOptions = [ - "--height 40%" - "--border" - "--ansi" - "--color bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD" - "--color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96" - "--color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD" - ]; - - fileWidgetCommand = "fd --type file --color=always"; - fileWidgetOptions = [ "--min-height 30 --preview-window noborder --preview '(bat --style=numbers,changes --wrap never --color always {} || cat {} || tree -C {}) 2> /dev/null'" ]; - catppuccin.enable = true; }; programs.ssh = { @@ -189,41 +221,16 @@ in userName = "Dustin Swan"; userEmail = "dustin@dustinswan.com"; signing = { - # signByDefault = true; + signByDefault = true; key = "AD11750151C10881970BD943AB49BD6B2B3A6377"; }; - delta = { - enable = true; - catppuccin.enable = true; - }; - }; - - programs.lazygit = { - enable = true; - catppuccin.enable = true; - }; - - programs.gitui = { - enable = true; - catppuccin.enable = true; - }; - - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - withNodeJs = true; - withPython3 = true; - withRuby = true; + delta.enable = true; }; - # xdg.configFile."nvim/lua/plugins/lazyvim-plugins.lua".source = ./lazyvim-plugins.lua; - programs.bat = { - enable = true; - catppuccin.enable = true; - }; + programs.lazygit.enable = true; + programs.gitui.enable = true; + programs.bat.enable = true; programs.gpg.enable = true; programs.tealdeer.enable = true; programs.ripgrep.enable = true; @@ -231,6 +238,7 @@ in programs.keychain = { enable = true; enableZshIntegration = true; + enableFishIntegration = true; inheritType = "any"; agents = [ "gpg" "ssh" ]; keys = [ "id_rsa" "id_rsa_mr" "2B3A6377" ]; diff --git a/home-gui.nix b/home-gui.nix index 60afdf4..6847b0a 100644 --- a/home-gui.nix +++ b/home-gui.nix @@ -1,7 +1,6 @@ { pkgs, ... }: { - # home.packages = with pkgs; [ iosevka-bin ]; fonts.fontconfig.enable = true; programs.alacritty = { @@ -22,6 +21,5 @@ size = 16.0; }; }; - catppuccin.enable = true; }; } diff --git a/home-mail.nix b/home-mail.nix index 141cebb..4a12b4e 100644 --- a/home-mail.nix +++ b/home-mail.nix @@ -4,14 +4,15 @@ let secrets = import ./secrets.nix; in { - home.packages = with pkgs; [ vdirsyncer khard khal imapnotify ]; - programs.mbsync.enable = true; programs.msmtp.enable = true; programs.himalaya.enable = true; - programs.notmuch.enable = true; + # programs.notmuch.enable = true; programs.aerc.enable = true; programs.aerc.extraConfig.general.unsafe-accounts-conf = true; + programs.khal.enable = true; + programs.khard.enable = true; + programs.vdirsyncer.enable = true; accounts.email = { maildirBasePath = "Mail"; @@ -47,19 +48,19 @@ in # onNotify = "\${pkgs.isync}/bin/mbsync -a"; # onNotifyPost = { mail = "\${pkgs.noti}/bin/noti 'New mail'"; }; # }; - notmuch.enable = true; + # notmuch.enable = true; msmtp.enable = true; aerc.enable = true; - # himalaya = { - # enable = true; - # settings = { - # backend = "maildir"; - # maildir.root-dir = ""; - # message.send.backend = "smtp"; + himalaya = { + enable = true; + settings = { + # backend = "imap"; + # maildir.root-dir = "/Users/dustinswan/Mail/FastMail"; + message.send.backend = "smtp"; # sent-folder = "Sent"; # draft-folder = "Drafts"; - # }; - # }; + }; + }; signature = { text = ''Dustin Swan | dustinswan.com''; showSignature = "append"; @@ -85,7 +86,7 @@ in expunge = "maildir"; }; msmtp.enable = true; - notmuch.enable = true; + # notmuch.enable = true; aerc.enable = true; # himalaya = { # enable = true; @@ -98,100 +99,124 @@ in }; }; -# TODO: home-manager now supports all this, don't need to do custom config files - - home.file.vdirsyncer = { - target = ".config/vdirsyncer/config"; - text = ''[general] -status_path = "~/.vdirsyncer/status/" - -[pair fastmail_contacts] -a = "fastmail_contacts_local" -b = "fastmail_contacts_remote" -collections = ["from b"] -conflict_resolution = "b wins" - -[storage fastmail_contacts_local] -type = "filesystem" -path = "~/Contacts/" -fileext = ".vcf" - -[storage fastmail_contacts_remote] -type = "carddav" -url = "https://carddav.messagingengine.com/" -username = "dustinswan@fastmail.com" -password.fetch = ["command", "~/dotfiles/bin/decrypt-password", "dustinswan@fastmail.com"] - - -[pair fastmail_calendar] -a = "fastmail_calendar_local" -b = "fastmail_calendar_remote" -collections = ["from b"] -conflict_resolution = "b wins" -metadata = ["color", "displayname"] - -[storage fastmail_calendar_local] -type = "filesystem" -path = "~/Calendars/Fastmail" -fileext = ".ics" - -[storage fastmail_calendar_remote] -type = "caldav" -url = "https://caldav.messagingengine.com/" -username = "dustinswan@fastmail.com" -password.fetch = ["command", "~/dotfiles/bin/decrypt-password", "dustinswan@fastmail.com"] + accounts.calendar = { + basePath = "Calendars"; + accounts = { + FastMail = { + khal = { + enable = true; + # addresses = [ "dustin@dustinswan.com" ]; + type = "discover"; + }; + primary = true; + remote = { + passwordCommand = ["~/dotfiles/bin/decrypt-password" "dustinswan@fastmail.com"]; + type = "caldav"; + url = "https://caldav.fastmail.com/"; + userName = "dustinswan@fastmail.com"; + }; + vdirsyncer = { + enable = true; + }; + }; + }; + }; +} +# TODO: home-manager now supports all this, don't need to do custom config files -[pair google_calendar] -a = "google_calendar_local" -b = "google_calendar_remote" -collections = null +# +# home.file.vdirsyncer = { +# target = ".config/vdirsyncer/config"; +# text = ''[general] +# status_path = "~/.vdirsyncer/status/" +# +# [pair fastmail_contacts] +# a = "fastmail_contacts_local" +# b = "fastmail_contacts_remote" +# collections = ["from b"] +# conflict_resolution = "b wins" +# +# [storage fastmail_contacts_local] +# type = "filesystem" +# path = "~/Contacts/" +# fileext = ".vcf" +# +# [storage fastmail_contacts_remote] +# type = "carddav" +# url = "https://carddav.messagingengine.com/" +# username = "dustinswan@fastmail.com" +# password.fetch = ["command", "~/dotfiles/bin/decrypt-password", "dustinswan@fastmail.com"] +# +# +# [pair fastmail_calendar] +# a = "fastmail_calendar_local" +# b = "fastmail_calendar_remote" +# collections = ["from b"] # conflict_resolution = "b wins" # metadata = ["color", "displayname"] - -[storage google_calendar_local] -type = "filesystem" -path = "~/Calendars/Google" -fileext = ".ics" - -[storage google_calendar_remote] -type = "http" -url = "${secrets.google-calendar.our-stuff}" -# type = "google_calendar" -# token_file = "~/token_file" -# client_id = "${secrets.google-vdirsyncer.id}" -# client_secret = "${secrets.google-vdirsyncer.secret}" -''; - }; - - home.file.khard = { - target = ".config/khard/khard.conf"; - text = ''[addressbooks] -[[contacts]] -path = ~/Contacts/Default - -[general] -default_action = list''; - }; - - home.file.khal = { - target = ".config/khal/config"; - text = ''[calendars] -[[Fastmail]] -path = ~/Calendars/Fastmail/* -color = light green -type = discover - -[[Google]] -path = ~/Calendars/Google -color = light blue -type = discover - -[locale] -timeformat = %H:%M -dateformat = %Y-%m-%d -longdateformat = %Y-%m-%d -datetimeformat = %Y-%m-%d %H:%M -longdatetimeformat = %Y-%m-%d %H:%M''; - }; -} +# +# [storage fastmail_calendar_local] +# type = "filesystem" +# path = "~/Calendars/Fastmail" +# fileext = ".ics" +# +# [storage fastmail_calendar_remote] +# type = "caldav" +# url = "https://caldav.messagingengine.com/" +# username = "dustinswan@fastmail.com" +# password.fetch = ["command", "~/dotfiles/bin/decrypt-password", "dustinswan@fastmail.com"] +# +# +# [pair google_calendar] +# a = "google_calendar_local" +# b = "google_calendar_remote" +# collections = null +# # conflict_resolution = "b wins" +# # metadata = ["color", "displayname"] +# +# [storage google_calendar_local] +# type = "filesystem" +# path = "~/Calendars/Google" +# fileext = ".ics" +# +# [storage google_calendar_remote] +# type = "http" +# url = "${secrets.google-calendar.our-stuff}" +# # type = "google_calendar" +# # token_file = "~/token_file" +# # client_id = "${secrets.google-vdirsyncer.id}" +# # client_secret = "${secrets.google-vdirsyncer.secret}" +# ''; +# }; +# +# home.file.khard = { +# target = ".config/khard/khard.conf"; +# text = ''[addressbooks] +# [[contacts]] +# path = ~/Contacts/Default +# +# [general] +# default_action = list''; +# }; +# +# home.file.khal = { +# target = ".config/khal/config"; +# text = ''[calendars] +# [[Fastmail]] +# path = ~/Calendars/Fastmail/* +# color = light green +# type = discover +# +# [[Google]] +# path = ~/Calendars/Google +# color = light blue +# type = discover +# +# [locale] +# timeformat = %H:%M +# dateformat = %Y-%m-%d +# longdateformat = %Y-%m-%d +# datetimeformat = %Y-%m-%d %H:%M +# longdatetimeformat = %Y-%m-%d %H:%M''; +# }; diff --git a/home-nvim.nix b/home-nvim.nix new file mode 100644 index 0000000..aa93e93 --- /dev/null +++ b/home-nvim.nix @@ -0,0 +1,105 @@ +{ ... }: + +{ + programs.nixvim = { + enable = true; + viAlias = true; + vimAlias = true; + withNodeJs = true; + withRuby = true; + + colorschemes.catppuccin.enable = true; + colorschemes.catppuccin.settings.transparent_background = true; + + opts = { + number = true; + ignorecase = true; + smartcase = true; + + tabstop = 4; + shiftwidth = 4; + softtabstop = 0; + expandtab = true; + smarttab = true; + + clipboard = "unnamedplus"; + }; + + globals = { + mapleader = " "; + maplocalleader = " "; + }; + + keymaps = [ + { key = "e"; action = "Neotree toggle"; } + { key = "ff"; action = "Telescope find_files"; } + { key = "fr"; action = "Telescope oldfiles"; } + { key = "bd"; action = "bdelete"; } + { key = ""; action = "bnext"; } + { key = ""; action = "bprev"; } + ]; + + plugins = { + bufferline.enable = true; + cmp = { + enable = true; + autoEnableSources = true; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "path"; } + { name = "buffer"; } + ]; + }; + cmp-nvim-lsp.enable = true; + cmp-buffer.enable = true; + cmp-path.enable = true; + codeium-nvim.enable = true; + commentary.enable = true; + # conform-nvim.enable = true; + dashboard.enable = true; + emmet.enable = true; + gitsigns.enable = true; + lazygit.enable = true; + lint.enable = true; + lualine.enable = true; + luasnip.enable = true; + lsp = { + enable = true; + inlayHints = true; + servers = { + eslint.enable = true; + html.enable = true; + lua-ls.enable = true; + nil-ls.enable = true; + # phpactor.enable = true; + intelephense.enable = true; + # rust-analyzer.enable = true; + tsserver.enable = true; + + }; + }; + lsp-format.enable = true; + lsp-lines.enable = true; + neo-tree.enable = true; + notify.enable = true; + nix.enable = true; + noice.enable = true; + nvim-autopairs.enable = true; + oil.enable = true; + orgmode = { + enable = true; + settings.org_agenda_files = "~/Sync/Notes/*"; + settings.org_default_notes_file = "~/Sync/Notes/Main.org"; + }; + persistence.enable = true; + surround.enable = true; + telescope.enable = true; + tmux-navigator.enable = true; + todo-comments.enable = true; + treesitter.enable = true; + trouble.enable = true; + ts-autotag.enable = true; + which-key.enable = true; + }; + }; +} diff --git a/lazyvim-options.lua b/lazyvim-options.lua deleted file mode 100644 index cb9a74d..0000000 --- a/lazyvim-options.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here - -vim.opt.relativenumber = false -vim.g.autoformat = false diff --git a/lazyvim-plugins.lua b/lazyvim-plugins.lua deleted file mode 100644 index 36c0d8b..0000000 --- a/lazyvim-plugins.lua +++ /dev/null @@ -1,121 +0,0 @@ -return { - - { "tpope/vim-sleuth" }, - - { - "catppuccin/nvim", - name = "catppuccin", - config = function() - require("catppuccin").setup({ - transparent_background = true, - }) - end, - }, - - -- { - -- "f-person/auto-dark-mode.nvim", - -- config = { - -- set_dark_mode = function() - -- vim.api.nvim_set_option("background", "dark") - -- vim.cmd("colorscheme catppuccin") - -- -- vim.cmd("colorscheme rose-pine") - -- end, - -- set_light_mode = function() - -- vim.api.nvim_set_option("background", "light") - -- vim.cmd("colorscheme catppuccin") - -- -- vim.cmd("colorscheme rose-pine") - -- end, - -- }, - -- }, - - { - "LazyVim/LazyVim", - opts = { - colorscheme = "catppuccin", - background_colour = "#000000", - }, - }, - - { - "nvim-orgmode/orgmode", - config = function() - -- require("orgmode").setup_ts_grammar() - - require("nvim-treesitter.configs").setup({ - highlight = { - enable = true, - additional_vim_regex_highlighting = { "org" }, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar - }, - ensure_installed = { "org" }, -- Or run :TSUpdate org - }) - - require("orgmode").setup({ - org_agenda_files = { "~/Sync/Notes/*" }, - org_default_notes_file = "~/Sync/Notes/Main.org", - }) - end, - }, - - { "dhruvasagar/vim-table-mode" }, - - { - "akinsho/toggleterm.nvim", - version = "*", - config = true, - keys = { - { [[]] }, - { - "TT", - "ToggleTerm direction=horizontal", - desc = "Open a horizontal terminal", - }, - { - "TV", - "ToggleTerm size=60 direction=vertical", - desc = "Open a vertical terminal", - }, - }, - }, - - { - "christoomey/vim-tmux-navigator", - cmd = { - "TmuxNavigateLeft", - "TmuxNavigateDown", - "TmuxNavigateUp", - "TmuxNavigateRight", - "TmuxNavigatePrevious", - }, - keys = { - { "", "TmuxNavigateLeft" }, - { "", "TmuxNavigateDown" }, - { "", "TmuxNavigateUp" }, - { "", "TmuxNavigateRight" }, - { "", "TmuxNavigatePrevious" }, - }, - }, - - { "lukas-reineke/headlines.nvim", opts = { org = { fat_headlines = false } } }, - - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "php", - }) - end, - }, - - { - "chrisgrieser/nvim-rip-substitute", - cmd = "RipSubstitute", - keys = { - { - "fs", - function() require("rip-substitute").sub() end, - mode = { "n", "x" }, - desc = " rip substitute", - }, - }, -}, -}