From 5230faf7c49f5d8d7611808f6901cbd7ab8bd10a Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Tue, 24 Sep 2024 05:41:40 +0200 Subject: [PATCH] Uhhhh, lots of changes I forgot to push earlier --- devshells/default.nix | 4 +- devshells/web.nix | 7 + home/features/cli/fish/default.nix | 41 +- home/features/cli/git.nix | 12 + home/features/desktop/discord/themes.nix | 8 +- home/features/neovim/config/init.lua | 2 + home/features/neovim/config/lazy-lock.json | 3 +- .../neovim/config/lua/my/helpers/folding.lua | 23 + home/features/neovim/config/lua/my/lazy.lua | 2 +- home/features/neovim/default.nix | 3118 +++++++++-------- home/features/neovim/snippets/tex.miros | 27 +- home/features/persistence.nix | 10 + hosts/nixos/calypso/default.nix | 3 + .../nixos/calypso/filesystems/partitions.nix | 10 +- .../optional/services/restic/default.nix | 5 + .../common/optional/services/syncthing.nix | 2 +- hosts/nixos/common/optional/users/pilot.nix | 24 +- hosts/nixos/iso/default.nix | 16 +- hosts/nixos/lapetus/default.nix | 11 +- hosts/nixos/tethys/default.nix | 3 + 20 files changed, 1697 insertions(+), 1634 deletions(-) create mode 100644 devshells/web.nix create mode 100644 home/features/neovim/config/lua/my/helpers/folding.lua diff --git a/devshells/default.nix b/devshells/default.nix index 53b815d..d14734c 100644 --- a/devshells/default.nix +++ b/devshells/default.nix @@ -1,9 +1,9 @@ args: { haskell = import ./haskell.nix args; + lua = import ./lua.nix args; purescript = import ./purescript.nix args; rwtw = import ./rwtw.nix args; typst = import ./typst.nix args; - lua = import ./lua.nix args; + web = import ./web.nix args; bootstrap = import ./bootstrap/shell.nix args; } - diff --git a/devshells/web.nix b/devshells/web.nix new file mode 100644 index 0000000..d01af0c --- /dev/null +++ b/devshells/web.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +pkgs.mkShell { + packages = with pkgs; [ + typescript + nodejs + ]; +} diff --git a/home/features/cli/fish/default.nix b/home/features/cli/fish/default.nix index 6266647..c0b6230 100644 --- a/home/features/cli/fish/default.nix +++ b/home/features/cli/fish/default.nix @@ -1,4 +1,9 @@ -{ pkgs, config, lib, ... }: +{ + pkgs, + config, + lib, + ... +}: let repaint = "commandline -f repaint"; fishKeybinds = { @@ -20,8 +25,10 @@ let "\\e\\[70\\;5u" = ''nvim +":lua require('mini.files').open()"''; }; - mkKeybind = key: value: - let escaped = lib.escapeShellArg value; + mkKeybind = + key: value: + let + escaped = lib.escapeShellArg value; in '' bind -M default ${key} ${escaped} @@ -29,18 +36,14 @@ let ''; in { - # {{{ Fzf + # {{{ Fzf programs.fzf = { enable = true; defaultOptions = [ "--no-scrollbar" ]; - changeDirWidgetOptions = [ - "--preview '${lib.getExe pkgs.eza} --icons --tree --color=always {}'" - ]; + changeDirWidgetOptions = [ "--preview '${lib.getExe pkgs.eza} --icons --tree --color=always {}'" ]; - fileWidgetOptions = [ - "--preview '${lib.getExe pkgs.bat} --number --color=always {}'" - ]; + fileWidgetOptions = [ "--preview '${lib.getExe pkgs.bat} --number --color=always {}'" ]; }; stylix.targets.fzf.enable = true; @@ -60,31 +63,25 @@ in ${lib.getExe pkgs.nix-your-shell} fish | source ''; - # {{{ Plugins + # {{{ Plugins plugins = let plugins = with pkgs.fishPlugins; [ z # Jump to directories by typing "z " - grc # Adds color to a bunch of built in commands done # Trigger a notification when long commands finish execution puffer # Text expansion (i.e. expanding .... to ../../../) sponge # Remove failed commands and whatnot from history - forgit # Git tui thingy? (I'm still trying this one out) - colored-man-pages # Self explainatory:) + colored-man-pages ]; in # For some reason home-manager expects a slightly different format 🤔 - lib.forEach plugins - (plugin: { - name = plugin.pname; - inherit (plugin) src; - }); + lib.forEach plugins (plugin: { + name = plugin.pname; + inherit (plugin) src; + }); # }}} }; - # I sometimes get errors about `grc` being missing, so I gave up and added it here. - home.packages = [ pkgs.grc ]; - satellite.persistence.at.state.apps.fish.directories = [ "${config.xdg.dataHome}/fish" "${config.xdg.dataHome}/z" # The z fish plugin requires this diff --git a/home/features/cli/git.nix b/home/features/cli/git.nix index a6ef9fa..7aea677 100644 --- a/home/features/cli/git.nix +++ b/home/features/cli/git.nix @@ -49,6 +49,18 @@ init.defaultBranch = "main"; rebase.autoStash = true; + push.default = "current"; + push.autoSetupRemote = true; + + # {{{ URL rewriting + url."git@github.com:".insteadOf = [ + # Normalize GitHub URLs to SSH to avoid authentication issues with HTTPS. + "https://github.com/" + + # Allows typing `git clone github:owner/repo`. + "github:" + ]; + # }}} # {{{ Signing # Sign commits using ssh gpg.format = "ssh"; diff --git a/home/features/desktop/discord/themes.nix b/home/features/desktop/discord/themes.nix index bc1edd6..5e97f1c 100644 --- a/home/features/desktop/discord/themes.nix +++ b/home/features/desktop/discord/themes.nix @@ -2,19 +2,19 @@ lib.fix (self: { "Catppuccin Mocha" = fetchurl { url = "https://catppuccin.github.io/discord/dist/catppuccin-mocha.theme.css"; - sha256 = "1gafrnm5mz8zh63zvcr3jp5fkzs9l0xnpwq3b4k7sbbzwg04nzw5"; + sha256 = "0y9vha3gb48yid65r2zfkc6l021j1s8mlac3klkbksla9gqnd9wr"; }; "Catppuccin Frappe" = fetchurl { url = "https://catppuccin.github.io/discord/dist/catppuccin-frappe.theme.css"; - sha256 = "05y43fcwgy4sv9q6c49r5c92jzvq8vjrk05wy2zblp5v7zrli7sl"; + sha256 = "19kmmydkbpig14ql6zn0vqzlfykm6qg7r317vwjzq9dg092lflam"; }; "Catppuccin Latte" = fetchurl { url = "https://catppuccin.github.io/discord/dist/catppuccin-latte.theme.css"; - sha256 = "1c7vwr8f6sip7lsyp770hm170pnld1ikvqdsh2fxlsdkkn6ay2k3"; + sha256 = "0lm1mzflyxmzpsyfkbcd1v7d1xp5i683yc6npbsm12z4hqn2smf6"; }; "Catppuccin Macchiato" = fetchurl { url = "https://catppuccin.github.io/discord/dist/catppuccin-macchiato.theme.css"; - sha256 = "11vig9i5kwhcbblspcp928gf4mvvp3v0qsibmh82wyxyw9ddzr7d"; + sha256 = "01zd5zf9b4a2kkwnkpzg37g1macan6201wyi7zj2crsbxy8b7j6k"; }; default.dark = self."Catppuccin Macchiato"; default.light = self."Catppuccin Latte"; diff --git a/home/features/neovim/config/init.lua b/home/features/neovim/config/init.lua index bba7b4b..2784b6d 100644 --- a/home/features/neovim/config/init.lua +++ b/home/features/neovim/config/init.lua @@ -8,3 +8,5 @@ local nix = require("nix") tempest.configureMany(nix.pre) require("my.lazy").setup() tempest.configureMany(nix.post) + +require("my.helpers.folding").setup() diff --git a/home/features/neovim/config/lazy-lock.json b/home/features/neovim/config/lazy-lock.json index 7fb53a2..5838df5 100644 --- a/home/features/neovim/config/lazy-lock.json +++ b/home/features/neovim/config/lazy-lock.json @@ -45,11 +45,10 @@ "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "plenary": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "purescript": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" }, - "rust-tools": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, + "rustacean": { "branch": "master", "commit": "5c0c44149e43b907dae2e0fe053284ad56226eb7" }, "rzip": { "branch": "master", "commit": "f65400fed27b27c7cff7ef8d428c4e5ff749bf28" }, "scrap": { "branch": "main", "commit": "cc8453ed613932c744c3d1ec42f379b78bd8b92c" }, "telescope": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "treesitter": { "branch": "master", "commit": "7f4ac678770175cdf0d42c015f4a5b6e18b6cb33" }, "typst": { "branch": "main", "commit": "4d18ced62599ffe5b3c0e5e49566d5456121bc02" }, "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, "wakatime": { "branch": "master", "commit": "3cb40867cb5a3120f9bef76eff88edc7f1dc1a23" }, diff --git a/home/features/neovim/config/lua/my/helpers/folding.lua b/home/features/neovim/config/lua/my/helpers/folding.lua new file mode 100644 index 0000000..374e944 --- /dev/null +++ b/home/features/neovim/config/lua/my/helpers/folding.lua @@ -0,0 +1,23 @@ +local M = {} + +local function createFold(name) + local commentstring = vim.o.commentstring + local start_comment = string.gsub(commentstring, "%%s", " {{{ " .. name) + local end_comment = string.gsub(commentstring, "%%s", " }}}") + + -- Leave visual mode + local esc = vim.api.nvim_replace_termcodes("", true, false, true) + vim.api.nvim_feedkeys(esc, "x", false) + + vim.cmd(":'>put='" .. end_comment .. "'") + vim.cmd(":'<-1put='" .. start_comment .. "'") +end + +function M.setup() + vim.keymap.set("v", "", function() + local name = vim.fn.input("Fold name: ") + createFold(name) + end, { desc = "Create fold markers around area" }) +end + +return M diff --git a/home/features/neovim/config/lua/my/lazy.lua b/home/features/neovim/config/lua/my/lazy.lua index 7c31eb7..132cc9b 100644 --- a/home/features/neovim/config/lua/my/lazy.lua +++ b/home/features/neovim/config/lua/my/lazy.lua @@ -26,7 +26,7 @@ function M.setup() fallback = true, -- Directory where I store my local plugin projects - path = vim.g.nix_projects_path, + path = vim.g.nix_projects_dir, patterns = { "prescientmoon" }, }, performance = { diff --git a/home/features/neovim/default.nix b/home/features/neovim/default.nix index cfee85f..21f9a8e 100644 --- a/home/features/neovim/default.nix +++ b/home/features/neovim/default.nix @@ -29,1625 +29,1627 @@ let mirosSnippetCache = "${config.xdg.cacheHome}/miros"; obsidianVault = "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/stellar-sanctum"; - generated = nlib.generateConfig ( - lib.fix ( - self: with nlib; { - # {{{ Pre-plugin config - pre = { - # {{{ General options - "0:general-options" = { - vim.g = { - # Disable filetype.vim - do_filetype_lua = true; - did_load_filetypes = false; + generated = + with nlib; + generateConfig { + # {{{ Pre-plugin config + pre = { + # {{{ General options + "0:general-options" = { + vim.g = { + # Disable filetype.vim + do_filetype_lua = true; + did_load_filetypes = false; - # Set leader - mapleader = " "; - }; + # Set leader + mapleader = " "; + }; - vim.opt = { - # Basic options - joinspaces = false; # No double spaces with join (mapped to qj in my config) - list = false; # I don't want to show things like tabs - cmdheight = 0; # Hide command line when it's not getting used - spell = true; # Spell checker + vim.opt = { + # Basic options + joinspaces = false; # No double spaces with join (mapped to qj in my config) + list = false; # I don't want to show things like tabs + cmdheight = 0; # Hide command line when it's not getting used + spell = true; # Spell checker - # tcqj are there by default, and "r" automatically continues comments on enter - formatoptions = "tcqjr"; + # tcqj are there by default, and "r" automatically continues comments on enter + formatoptions = "tcqjr"; - scrolloff = 4; # Starts scrolling 4 lines from the edge of the screen - termguicolors = true; # True color support + scrolloff = 4; # Starts scrolling 4 lines from the edge of the screen + termguicolors = true; # True color support - wrap = false; # Disable line wrap (by default) - wildmode = [ - "list" - "longest" - ]; # Command-line completion mode - completeopt = [ - "menu" - "menuone" - "noselect" - ]; + wrap = false; # Disable line wrap (by default) + wildmode = [ + "list" + "longest" + ]; # Command-line completion mode + completeopt = [ + "menu" + "menuone" + "noselect" + ]; - undofile = true; # persist undos!! + undofile = true; # persist undos!! - # {{{ Line numbers - number = true; # Show line numbers - relativenumber = true; # Relative line numbers - # }}} - # {{{ Indents - expandtab = true; # Use spaces for the tab char - shiftwidth = 2; # Size of an indent - tabstop = 2; # Size of tab character - shiftround = true; # When using < or >, rounds to closest multiple of shiftwidth - smartindent = true; # Insert indents automatically - # }}} - # {{{ Casing - ignorecase = true; # Ignore case - smartcase = true; # Do not ignore case with capitals - # }}} - # {{{ Splits - splitbelow = true; # Put new windows below current - splitright = true; # Put new windows right of current - # }}} - # {{{ Folding - foldmethod = "marker"; # use {{{ }}} for folding - foldcolumn = "0"; # show no column with folds on the left - # }}} - }; - - # {{{Disable pseudo-transparency; - autocmds = { - event = "FileType"; - group = "WinblendSettings"; - action.vim.opt.winblend = 0; - }; - # }}} - - # {{{ Starter page - callback = - # lua - thunk '' - local cwd = vim.loop.cwd() - local header - - if cwd == ${encode obsidianVault} then - header = ${encode (builtins.readFile ./headers/obsidian.txt)} - else - header = ${encode (builtins.readFile ./headers/main.txt)} - end - - require("my.starter").setup({ header = header }) - ''; + # {{{ Line numbers + number = true; # Show line numbers + relativenumber = true; # Relative line numbers + # }}} + # {{{ Indents + expandtab = true; # Use spaces for the tab char + shiftwidth = 2; # Size of an indent + tabstop = 2; # Size of tab character + shiftround = true; # When using < or >, rounds to closest multiple of shiftwidth + smartindent = true; # Insert indents automatically + # }}} + # {{{ Casing + ignorecase = true; # Ignore case + smartcase = true; # Do not ignore case with capitals + # }}} + # {{{ Splits + splitbelow = true; # Put new windows below current + splitright = true; # Put new windows right of current + # }}} + # {{{ Folding + foldmethod = "marker"; # use {{{ }}} for folding + foldcolumn = "0"; # show no column with folds on the left # }}} }; - # }}} - # {{{ Misc keybinds - "1:misc-keybinds" = { - # {{{ Global keybinds - keys = - # {{{ Keybind helpers - let - dmap = mapping: action: desc: { - inherit mapping desc; - action = vim /diagnostic/${action}; - }; - in - # }}} - [ - # {{{ Free up q and Q - (nmap "" "q" "Record macro") - (nmap "" "Q" "Repeat last recorded macro") - (unmap "q") - (unmap "Q") - # }}} - # {{{ Chords - # Different chords get remapped to f-keys by my [my kaanta config](../../../hosts/nixos/common/optional/services/kanata.nix). - # - # Exit insert mode using *jk* - (keymap "iv" "" "" "Exit insert mode") - # Use global clipboard using *cp* - (keymap "nv" "" ''"+'' "Use global clipboard") - # Save using *ji* - (nmap "" (thunk '' - -- If we don't do this, the statusbar will flash for a second... - vim.cmd([[silent! write]]) - vim.opt.stl = vim.opt.stl - '') "Save current file") - # }}} - # {{{ Newline without comments - { - mode = "i"; - mapping = ""; - action = - _: - vim /paste (args [ - [ - "" - "" - ] - (-1) - ]); - desc = "Insert newline without continuing the current comment"; - } - { - mode = "i"; - mapping = ""; - # This is a bit scuffed and might not work for all languages - action = "norm O"; - desc = "Insert newline above without continuing the current comment"; - } - # }}} - # {{{ Diagnostics - (dmap "[d" "goto_prev" "Goto previous [d]iagnostic") - (dmap "]d" "goto_next" "Goto next [d]iagnostic") - (dmap "J" "open_float" "Open current diagnostic") - (dmap "D" "setloclist" "[D]iagnostic loclist") - (nmap "qj" "J" "join lines") - # }}} - # {{{ Other misc keybinds - (nmap "a" "" "[A]lternate file") - (unmap "") - (nmap "Q" ":wqa" "Save all files and [q]uit") - (nmap "rw" ":%s//" "[R]eplace [w]ord in file") - (nmap "sw" (require "my.helpers.wrap" /toggle) "toggle word [w]rap") - (nmap "ss" ( - # lua - thunk "vim.opt.spell = not vim.o.spell" - ) "toggle [s]pell checker") - (nmap "yp" "!curl --data-binary @% https://paste.rs" "[y]ank [p]aste.rs link") - # }}} - ]; + # {{{Disable pseudo-transparency; + autocmds = { + event = "FileType"; + group = "WinblendSettings"; + action.vim.opt.winblend = 0; + }; + # }}} + + # {{{ Starter page + callback = + # lua + thunk '' + local cwd = vim.loop.cwd() + local header + + if cwd == ${encode obsidianVault} then + header = ${encode (builtins.readFile ./headers/obsidian.txt)} + else + header = ${encode (builtins.readFile ./headers/main.txt)} + end + + require("my.starter").setup({ header = header }) + ''; + # }}} + }; + # }}} + # {{{ Misc keybinds + "1:misc-keybinds" = { + # {{{ Global keybinds + keys = + # {{{ Keybind helpers + let + dmap = mapping: action: desc: { + inherit mapping desc; + action = vim /diagnostic/${action}; + }; + in # }}} - # {{{ Autocmds - autocmds = [ - # {{{ Exit certain buffers with qq + [ + # {{{ Free up q and Q + (nmap "" "q" "Record macro") + (nmap "" "Q" "Repeat last recorded macro") + (unmap "q") + (unmap "Q") + # }}} + # {{{ Chords + # Different chords get remapped to f-keys by my [my kaanta config](../../../hosts/nixos/common/optional/services/kanata.nix). + # + # Exit insert mode using *jk* + (keymap "iv" "" "" "Exit insert mode") + + # Use global clipboard using *cp* + (keymap "nv" "" ''"+'' "Use global clipboard") + # Save using *ji* + (nmap "" (thunk '' + -- If we don't do this, the statusbar will flash for a second... + vim.cmd([[silent! write]]) + vim.opt.stl = vim.opt.stl + '') "Save current file") + # }}} + # {{{ Newline without comments { - event = "FileType"; - pattern = [ "help" ]; - group = "BasicBufferQuitting"; - action.keys = nmap "qq" "close" "[q]uit current buffer"; + mode = "i"; + mapping = ""; + action = + _: + vim /paste (args [ + [ + "" + "" + ] + (-1) + ]); + desc = "Insert newline without continuing the current comment"; + } + { + mode = "i"; + mapping = ""; + # This is a bit scuffed and might not work for all languages + action = "norm O"; + desc = "Insert newline above without continuing the current comment"; } # }}} - # {{{ Enable wrap movemenets by default in certain filetypes - { - event = "FileType"; - pattern = [ - "markdown" - "typst" - "tex" - ]; - group = "EnableWrapMovement"; - action = require "my.helpers.wrap" /enable; - } + # {{{ Diagnostics + (dmap "[d" "goto_prev" "Goto previous [d]iagnostic") + (dmap "]d" "goto_next" "Goto next [d]iagnostic") + (dmap "J" "open_float" "Open current diagnostic") + (dmap "D" "setloclist" "[D]iagnostic loclist") + (nmap "qj" "J" "join lines") + # }}} + # {{{ Other misc keybinds + (nmap "a" "" "[A]lternate file") + (unmap "") + (nmap "Q" ":wqa" "Save all files and [q]uit") + (nmap "rw" ":%s//" "[R]eplace [w]ord in file") + (nmap "sw" (require "my.helpers.wrap" /toggle) "toggle word [w]rap") + (nmap "ss" ( + # lua + thunk "vim.opt.spell = not vim.o.spell" + ) "toggle [s]pell checker") + (nmap "yp" "!curl --data-binary @% https://paste.rs" "[y]ank [p]aste.rs link") # }}} ]; - # }}} - }; # }}} - # {{{ Manage cmdheight - "2:manage-cmdheight".autocmds = [ + # {{{ Autocmds + autocmds = [ + # {{{ Exit certain buffers with qq { - event = "CmdlineEnter"; - group = "SetCmdheightCmdlineEnter"; - action.vim.opt.cmdheight = 1; + event = "FileType"; + pattern = [ "help" ]; + group = "BasicBufferQuitting"; + action.keys = nmap "qq" "close" "[q]uit current buffer"; } + # }}} + # {{{ Enable wrap movemenets by default in certain filetypes { - event = "CmdlineLeave"; - group = "SetCmdheightCmdlineLeave"; - action.vim.opt.cmdheight = 0; + event = "FileType"; + pattern = [ + "markdown" + "typst" + "tex" + ]; + group = "EnableWrapMovement"; + action = require "my.helpers.wrap" /enable; } + # }}} ]; # }}} - # {{{ Lsp settings - "3:lsp-settings" = { - # {{{ Change lsp on-hover borders - vim.lsp.handlers."textDocument/hover" = vim /lsp/with (args [ - (vim /lsp/handlers/hover) - { border = "single"; } - ]); - vim.lsp.handlers."textDocument/signatureHelp" = vim /lsp/with (args [ - (vim /lsp/handlers/signature_help) - { border = "single"; } - ]); - # }}} - # {{{ Create on-attach keybinds - autocmds = { - event = "LspAttach"; - group = "UserLspConfig"; - action = - let - nmap = - mapping: action: desc: - nlib.nmap mapping (vim /lsp/buf/${action}) desc; - in - { - mkContext = event: { - bufnr = lua event /buf; - client = vim /lsp/get_client_by_id (lua event /data/client_id); - }; - keys = [ - (nlib.nmap "li" "LspInfo" "[L]sp [i]nfo") - (nmap "gd" "definition" "[G]o to [d]efinition") - (nmap "gi" "implementation" "[G]o to [i]mplementation") - (nmap "gr" "references" "[G]o to [r]eferences") - (nmap "L" "signature_help" "Signature help") - (nmap "c" "code_action" "[C]ode actions") - (keymap "v" "c" ":'<,'> lua vim.lsp.buf.range_code_action()" "[C]ode actions") - (nmap "wa" "add_workspace_folder" "[W]orkspace [A]dd Folder") - (nmap "wr" "remove_workspace_folder" "[W]orkspace [R]emove Folder") - (nlib.nmap "wl" ( - _: print (vim /inspect (vim /ps/buf/list_workspace_folders none)) - ) "[W]orkspace [L]ist Folders") - ]; - callback = { - cond = ctx: return (lua ctx /client/supports_method "textDocument/hover"); - keys = nmap "K" "hover" "Hover"; - }; - }; - }; - # }}} - }; + }; + # }}} + # {{{ Manage cmdheight + "2:manage-cmdheight".autocmds = [ + { + event = "CmdlineEnter"; + group = "SetCmdheightCmdlineEnter"; + action.vim.opt.cmdheight = 1; + } + { + event = "CmdlineLeave"; + group = "SetCmdheightCmdlineLeave"; + action.vim.opt.cmdheight = 0; + } + ]; + # }}} + # {{{ Lsp settings + "3:lsp-settings" = { + # {{{ Change lsp on-hover borders + vim.lsp.handlers."textDocument/hover" = vim /lsp/with (args [ + (vim /lsp/handlers/hover) + { border = "single"; } + ]); + vim.lsp.handlers."textDocument/signatureHelp" = vim /lsp/with (args [ + (vim /lsp/handlers/signature_help) + { border = "single"; } + ]); # }}} - # {{{ Neovide config - "4:configure-neovide" = { - cond = whitelist "neovide"; - vim.g = { - neovide_transparency = tempest /theme/transparency/applications/value; - neovide_cursor_animation_length = 4.0e-2; - neovide_cursor_animate_in_insert_mode = false; - }; - }; - # }}} - # {{{ Language specific overrides - "5:language-specific-settings" = { - autocmds = [ - # {{{ Nix + # {{{ Create on-attach keybinds + autocmds = { + event = "LspAttach"; + group = "UserLspConfig"; + action = + let + nmap = + mapping: action: desc: + nlib.nmap mapping (vim /lsp/buf/${action}) desc; + in { - event = "FileType"; - group = "UserNixSettings"; - pattern = "nix"; - action = { - vim.opt.commentstring = "# %s"; - keys = { - mapping = "lg"; - action = - _: - let - cmd = _: vim /cmd ":%!${lib.getExe pkgs.update-nix-fetchgit}"; - in - tempest /withSavedCursor cmd; - desc = "Update all fetchgit calls"; - }; + mkContext = event: { + bufnr = lua event /buf; + client = vim /lsp/get_client_by_id (lua event /data/client_id); }; - } - # }}} - # {{{ Purescript - { - event = "FileType"; - group = "UserPurescriptSettings"; - pattern = "purs"; - action.vim.opt = { - expandtab = true; # Use spaces for the tab char - commentstring = "-- %s"; + keys = [ + (nlib.nmap "li" "LspInfo" "[L]sp [i]nfo") + (nmap "gd" "definition" "[G]o to [d]efinition") + (nmap "gi" "implementation" "[G]o to [i]mplementation") + (nmap "gr" "references" "[G]o to [r]eferences") + (nmap "L" "signature_help" "Signature help") + (nmap "c" "code_action" "[C]ode actions") + (keymap "v" "c" ":'<,'> lua vim.lsp.buf.range_code_action()" "[C]ode actions") + (nmap "wa" "add_workspace_folder" "[W]orkspace [A]dd Folder") + (nmap "wr" "remove_workspace_folder" "[W]orkspace [R]emove Folder") + (nlib.nmap "wl" ( + _: print (vim /inspect (vim /ps/buf/list_workspace_folders none)) + ) "[W]orkspace [L]ist Folders") + ]; + callback = { + cond = ctx: return (lua ctx /client/supports_method "textDocument/hover"); + keys = nmap "K" "hover" "Hover"; }; - } - # }}} - ]; + }; }; # }}} }; # }}} - # {{{ Plugins - lazy = { - # {{{ libraries - # {{{ plenary - plenary = { - package = "nvim-lua/plenary.nvim"; - # Autoload when running tests - cmd = [ - "PlenaryBustedDirectory" - "PlenaryBustedFile" - ]; + # {{{ Neovide config + "4:configure-neovide" = { + cond = whitelist "neovide"; + vim.g = { + neovide_transparency = tempest /theme/transparency/applications/value; + neovide_cursor_animation_length = 4.0e-2; + neovide_cursor_animate_in_insert_mode = false; }; - # }}} - # {{{ nui - nui.package = "MunifTanjim/nui.nvim"; - # }}} - # {{{ web-devicons - web-devicons.package = "nvim-tree/nvim-web-devicons"; - # }}} - # {{{ scrap - scrap = { - package = "prescientmoon/scrap.nvim"; + }; + # }}} + # {{{ Language specific overrides + "5:language-specific-settings" = { + autocmds = [ + # {{{ Nix + { + event = "FileType"; + group = "UserNixSettings"; + pattern = "nix"; + action = { + vim.opt.commentstring = "# %s"; + keys = { + mapping = "lg"; + action = + _: + let + cmd = _: vim /cmd ":%!${lib.getExe pkgs.update-nix-fetchgit}"; + in + tempest /withSavedCursor cmd; + desc = "Update all fetchgit calls"; + }; + }; + } + # }}} + # {{{ Purescript + { + event = "FileType"; + group = "UserPurescriptSettings"; + pattern = "purs"; + action.vim.opt = { + expandtab = true; # Use spaces for the tab char + commentstring = "-- %s"; + }; + } + # }}} + ]; + }; + # }}} + }; + # }}} + # {{{ Plugins + lazy = { + # {{{ libraries + # {{{ plenary + plenary = { + package = "nvim-lua/plenary.nvim"; + # Autoload when running tests + cmd = [ + "PlenaryBustedDirectory" + "PlenaryBustedFile" + ]; + }; + # }}} + # {{{ nui + nui.package = "MunifTanjim/nui.nvim"; + # }}} + # {{{ web-devicons + web-devicons.package = "nvim-tree/nvim-web-devicons"; + # }}} + # {{{ scrap + scrap = { + package = "prescientmoon/scrap.nvim"; - event = "InsertEnter"; - config.setup."my.abbreviations" = true; - }; - # }}} - # }}} - # {{{ ui - # {{{ mini.statusline - mini-statusline = { - package = "echasnovski/mini.statusline"; - name = "mini.statusline"; - dependencies.lua = [ "web-devicons" ]; + event = "InsertEnter"; + config.setup."my.abbreviations" = true; + }; + # }}} + # }}} + # {{{ ui + # {{{ mini.statusline + mini-statusline = { + package = "echasnovski/mini.statusline"; + name = "mini.statusline"; + dependencies.lua = [ "web-devicons" ]; - cond = blacklist [ - "vscode" - "firenvim" + cond = blacklist [ + "vscode" + "firenvim" + ]; + lazy = false; + + opts.content.inactive = + _: + require "mini.statusline" /combine_groups [ + { + hl = "MiniStatuslineFilename"; + strings = [ (vim /fn/expand "%:t") ]; + } ]; - lazy = false; - opts.content.inactive = - _: - require "mini.statusline" /combine_groups [ - { - hl = "MiniStatuslineFilename"; - strings = [ (vim /fn/expand "%:t") ]; - } - ]; + opts.content.active = + # lua + thunk '' + local st = require("mini.statusline"); + local mode, mode_hl = st.section_mode({ trunc_width = 120 }) + local git = st.section_git({ trunc_width = 75 }) + local diagnostics = st.section_diagnostics({ trunc_width = 75 }) - opts.content.active = + return st.combine_groups({ + { hl = mode_hl, strings = { mode } }, + { hl = "MiniStatuslineDevinfo", strings = { git } }, + { hl = "MiniStatuslineFilename", strings = { + vim.fn.fnamemodify(vim.fn.expand("%:p"), ":~:.") + } }, + "%=", -- End left alignment + { hl = "MiniStatuslineFilename", strings = { diagnostics } }, + { hl = "MiniStatuslineDevinfo", strings = { vim.bo.filetype } }, + }) + ''; + }; + # }}} + # {{{ mini.files + mini-files = { + package = "echasnovski/mini.files"; + name = "mini.files"; + dependencies.lua = [ "web-devicons" ]; + + cond = blacklist [ + "vscode" + "firenvim" + ]; + keys = { + mapping = ""; + desc = "[S]earch [F]iles"; + action = # lua thunk '' - local st = require("mini.statusline"); - local mode, mode_hl = st.section_mode({ trunc_width = 120 }) - local git = st.section_git({ trunc_width = 75 }) - local diagnostics = st.section_diagnostics({ trunc_width = 75 }) - - return st.combine_groups({ - { hl = mode_hl, strings = { mode } }, - { hl = "MiniStatuslineDevinfo", strings = { git } }, - { hl = "MiniStatuslineFilename", strings = { - vim.fn.fnamemodify(vim.fn.expand("%:p"), ":~:.") - } }, - "%=", -- End left alignment - { hl = "MiniStatuslineFilename", strings = { diagnostics } }, - { hl = "MiniStatuslineDevinfo", strings = { vim.bo.filetype } }, - }) + local files = require("mini.files") + if not files.close() then + files.open(vim.api.nvim_buf_get_name(0)) + files.reveal_cwd() + end ''; }; - # }}} - # {{{ mini.files - mini-files = { - package = "echasnovski/mini.files"; - name = "mini.files"; - dependencies.lua = [ "web-devicons" ]; - cond = blacklist [ - "vscode" - "firenvim" + opts.windows.preview = false; + opts.mappings.go_in_plus = "l"; + }; + # }}} + # {{{ harpoon + harpoon = { + package = "ThePrimeagen/harpoon"; + event = "VeryLazy"; + keys = + let + goto = key: index: { + desc = "Goto harpoon file ${toString index}"; + mapping = "${key}"; + action = _: require "harpoon.ui" /nav_file (toString index); + }; + in + [ + { + desc = "Add file to [h]arpoon"; + mapping = "H"; + action = _: require "harpoon.mark" /add_file none; + } + { + desc = "Toggle harpoon quickmenu"; + mapping = ""; + action = _: require "harpoon.ui" /toggle_quick_menu none; + } + (goto "q" 1) + (goto "w" 2) + (goto "e" 3) + (goto "r" 4) + (goto "a" 5) + (goto "s" 6) + (goto "d" 7) + (goto "f" 8) + (goto "z" 9) ]; - keys = { - mapping = ""; - desc = "[S]earch [F]iles"; + }; + # }}} + # {{{ telescope + telescope = { + package = "nvim-telescope/telescope.nvim"; + version = "0.1.x"; + cond = blacklist "vscode"; + event = "VeryLazy"; + + # {{{ Dependencies + dependencies = { + nix = [ pkgs.ripgrep ]; + lua = [ + "plenary" + { + # We want a prebuilt version of this plugin + dir = pkgs.vimPlugins.telescope-fzf-native-nvim; + name = "telescope-fzf-native"; + } + ]; + }; + # }}} + # {{{ Keymaps + keys = + let + nmap = mapping: action: desc: { + inherit mapping desc; + action = "Telescope ${action} theme=ivy"; + }; + + findFilesByExtension = + mapping: extension: tag: + nmap "f${mapping}" "find_files find_command=rg,--files,--glob=**/*.${extension}" + "Find ${tag} files"; + in + [ + (nmap "" "find_files" "File finder [p]alette") + (nmap "d" "diagnostics root_dir=true" "[D]iagnostics") + (nmap "" "live_grep" "[F]ind in project") + (nmap "" "builtin" "[T]elescope pickers") + # {{{ Files by extension + (findFilesByExtension "tx" "tex" "[t]ex") + (findFilesByExtension "ts" "ts" "[t]ypescript") + (findFilesByExtension "ty" "typ" "[t]ypst") + (findFilesByExtension "l" "lua" "[l]ua") + (findFilesByExtension "n" "nix" "[n]ua") + (findFilesByExtension "p" "purs" "[p]urescript") + (findFilesByExtension "h" "hs" "[h]askell") + (findFilesByExtension "e" "elm" "[e]lm") + (findFilesByExtension "r" "rs" "[r]ust") + # }}} + ]; + # }}} + # {{{ Disable folds in telescope windows + config.autocmds = { + event = "FileType"; + pattern = "TelescopeResults"; + group = "TelescopeResultsDisableFolds"; + action.vim.opt.foldenable = false; + }; + # }}} + # {{{ Load fzf extension + config.callback = _: require "telescope" /load_extension "fzf"; + # }}} + # {{{ Options + opts.defaults.mappings.i."" = "which_key"; + opts.extensions.fzf = { + fuzzy = true; + override_generic_sorter = true; + override_file_sorter = true; + }; + # }}} + }; + # }}} + # {{{ dressing + dressing = { + package = "stevearc/dressing.nvim"; + + cond = blacklist "vscode"; + event = "VeryLazy"; + + opts = { + select.backend = [ + "nui" + "builtin" + "telescope" + ]; + input.insert_only = false; + }; + }; + # }}} + # }}} + # {{{ visual + # The line between `ui` and `visual` is a bit rought. I currenlty mostly judge + # it by vibe. + # {{{ indent-blankline + indent-blankline = { + package = "lukas-reineke/indent-blankline.nvim"; + main = "ibl"; + + cond = blacklist "vscode"; + event = "VeryLazy"; + config = true; + + # {{{ Keybinds + keys = + let + # {{{ List of fold-related keybinds + foldKeybinds = [ + "zo" + "zO" + "zc" + "zC" + "za" + "zA" + "zv" + "zx" + "zX" + "zm" + "zM" + "zr" + "zR" + ]; + in + # }}} + [ (nmap "si" "IBLToggle" "Toggle blankline indentation") ] + ++ (lib.forEach foldKeybinds ( + from: + nmap from "${from}IBLToggleIBLToggle" "Overriden ${from} (fold-related thing)" + )); + # }}}} + }; + # }}} + # {{{ live-command + # Live command preview for commands like :norm + live-command = { + package = "smjonas/live-command.nvim"; + version = "remote"; # https://github.com/smjonas/live-command.nvim/pull/29 + main = "live-command"; + + event = "CmdlineEnter"; + opts.commands.Norm.cmd = "norm"; + opts.commands.G.cmd = "g"; + + keys = keymap "v" "N" ":Norm " "Map lines in [n]ormal mode"; + }; + # }}} + # {{{ fidget + fidget = { + package = "j-hui/fidget.nvim"; + tag = "legacy"; + + cond = blacklist "vscode"; + event = "BufReadPre"; + config = true; + }; + # }}} + # {{{ treesitter + treesitter = { + # REASON: more grammars + dir = pkgs.symlinkJoin { + name = "treesitter-with-parsers"; + paths = [ + upkgs.vimPlugins.nvim-treesitter.withAllGrammars + upkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies + ]; + }; + # package = "nvim-treesitter/nvim-treesitter"; + main = "nvim-treesitter.configs"; + + dependencies.nix = [ pkgs.tree-sitter ]; + + cond = blacklist "vscode"; + event = "VeryLazy"; + + #{{{ Highlighting + opts.highlight = { + enable = true; + disable = [ "kotlin" ]; # This one seemed a bit broken + additional_vim_regex_highlighting = false; + }; + #}}} + + opts.indent.enable = true; + }; + # }}} + # }}} + # {{{ editing + # {{{ text navigation + # {{{ flash + flash = { + package = "folke/flash.nvim"; + + cond = blacklist "vscode"; + keys = + let + nmap = mode: mapping: action: desc: { + inherit mapping desc mode; + action = _: require "flash" /${action} none; + }; + in + [ + (nmap "nxo" "s" "jump" "Flash") + (nmap "nxo" "S" "treesitter" "Flash Treesitter") + (nmap "o" "r" "remote" "Remote Flash") + (nmap "ox" "R" "treesitter_search" "Treesitter Search") + (nmap "c" "" "toggle" "Toggle Flash Search") + ]; + + # Disable stuff like f/t/F/T + opts.modes.char.enabled = false; + }; + # }}} + # {{{ ftft (quickscope but written in lua) + ftft = { + package = "gukz/ftFT.nvim"; + + cond = blacklist "vscode"; + keys = [ + "f" + "F" + "t" + "T" + ]; + config = true; + }; + # }}} + # }}} + # {{{ clipboard-image + clipboard-image = { + package = "postfen/clipboard-image.nvim"; + + cond = blacklist "firenvim"; + cmd = "PasteImg"; + + keys = { + mapping = "p"; + action = "PasteImg"; + desc = "[P]aste image from clipboard"; + }; + + opts.default.img_name = importFrom ./plugins/clipboard-image.lua "img_name"; + opts.tex = { + img_dir = [ + "%:p:h" + "img" + ]; + affix = "\\includegraphics[width=\\textwidth]{%s}"; + }; + opts.typst = { + img_dir = [ + "%:p:h" + "img" + ]; + affix = ''#image("%s", width: 100)''; + }; + }; + # }}} + # {{{ lastplace + lastplace = { + package = "ethanholz/nvim-lastplace"; + + cond = blacklist "vscode"; + event = "BufReadPre"; + + opts.lastplace_ignore_buftype = [ + "quickfix" + "nofile" + "help" + ]; + }; + # }}} + # {{{ undotree + undotree = { + package = "mbbill/undotree"; + + cond = blacklist "vscode"; + cmd = "UndotreeToggle"; + keys = nmap "u" "UndoTreeToggle" "[U]ndo tree"; + }; + # }}} + # {{{ mini.ai + mini-ai = { + package = "echasnovski/mini.ai"; + name = "mini.ai"; + event = "VeryLazy"; + + opts = + _: # lazy, as we import mini.ai inside + let + balanced = from: [ + "%b${from}" + "^.().*().$" + ]; + in + { + custom_textobjects = { + b = balanced "()"; + B = balanced "{}"; + r = balanced "[]"; + v = [ + "⟨.-⟩" + "^⟨().*()⟩$" + ]; + q = balanced "\"\""; + Q = balanced "``"; + a = balanced "''"; + A = require "mini.ai" /gen_spec/argument none; + }; + }; + }; + # }}} + # {{{ mini.comment + mini-comment = { + package = "echasnovski/mini.comment"; + name = "mini.comment"; + + config = true; + keys = [ + { + mapping = "gc"; + mode = "nxv"; + } + "gcc" + ]; + }; + # }}} + # {{{ mini.surround + mini-surround = { + package = "echasnovski/mini.surround"; + name = "mini.surround"; + + keys = lib.flatten [ + # ^ doing the whole `flatten` thing to lie to my formatter + { + mapping = "s"; + mode = "nv"; + } + [ + "d" + "f" + "F" + "h" + "r" + ] + ]; + + # {{{ Keybinds + opts.mappings = { + add = "s"; # Add surrounding in Normal and Visul modes + delete = "d"; # Delete surrounding + find = "f"; # Find surrounding (to the right) + find_left = "F"; # Find surrounding (to the left) + highlight = "h"; # Highlight surrounding + replace = "r"; # Replace surrounding + update_n_lines = ""; # Update `n_lines` + }; + # }}} + # {{{ Custom surroundings + opts.custom_surroundings = + let + mk = balanced: input: left: right: { + input = [ + input + (if balanced then "^.%s*().-()%s*.$" else "^.().*().$") + ]; + output = { + inherit left right; + }; + }; + in + { + b = mk true "%b()" "(" ")"; + B = mk true "%b{}" "{" "}"; + r = mk true "%b[]" "[" "]"; + v = mk true "%b⟨⟩" "⟨" "⟩"; + q = mk false "\".-\"" "\"" "\""; + Q = mk false "`.-`" "`" "`"; + a = mk false "'.-'" "'" "'"; + }; + # }}} + }; + # }}} + # {{{ mini.operators + mini-operators = { + package = "echasnovski/mini.operators"; + name = "mini.operators"; + + config = true; + keys = + let + operator = key: [ + { + mapping = "g${key}"; + mode = "nv"; + } + "g${key}${key}" + ]; + in + lib.flatten [ + (operator "=") + (operator "x") + (operator "r") + (operator "s") + ]; + }; + # }}} + # {{{ mini.pairs + mini-pairs = { + package = "echasnovski/mini.pairs"; + name = "mini.pairs"; + + # We could specify all the generated bindings, but I don't think it's worth it + event = [ + "InsertEnter" + "CmdlineEnter" + ]; + }; + # }}} + # {{{ luasnip + # snippeting engine + luasnip = { + package = "L3MON4D3/LuaSnip"; + version = "v2"; + + cond = blacklist "vscode"; + config = + _: + do [ + (require "luasnip" /config/setup { + enable_autosnippets = true; + update_events = [ + "TextChanged" + "TextChangedI" + ]; + }) + + (require "luasnip.loaders.from_lua" /lazy_load { fs_event_providers.libuv = true; }) + ]; + + # {{{ Keybinds + keys = [ + { + mode = "i"; + expr = true; + mapping = ""; action = # lua thunk '' - local files = require("mini.files") - if not files.close() then - files.open(vim.api.nvim_buf_get_name(0)) - files.reveal_cwd() + local luasnip = require("luasnip") + + if not luasnip.jumpable(1) then + return "" end + + vim.schedule(function() + luasnip.jump(1) + end) + + return "" ''; - }; - - opts.windows.preview = false; - opts.mappings.go_in_plus = "l"; - }; - # }}} - # {{{ harpoon - harpoon = { - package = "ThePrimeagen/harpoon"; - event = "VeryLazy"; - keys = - let - goto = key: index: { - desc = "Goto harpoon file ${toString index}"; - mapping = "${key}"; - action = _: require "harpoon.ui" /nav_file (toString index); - }; - in - [ - { - desc = "Add file to [h]arpoon"; - mapping = "H"; - action = _: require "harpoon.mark" /add_file none; - } - { - desc = "Toggle harpoon quickmenu"; - mapping = ""; - action = _: require "harpoon.ui" /toggle_quick_menu none; - } - (goto "q" 1) - (goto "w" 2) - (goto "e" 3) - (goto "r" 4) - (goto "a" 5) - (goto "s" 6) - (goto "d" 7) - (goto "f" 8) - (goto "z" 9) - ]; - }; - # }}} - # {{{ telescope - telescope = { - package = "nvim-telescope/telescope.nvim"; - version = "0.1.x"; - cond = blacklist "vscode"; - event = "VeryLazy"; - - # {{{ Dependencies - dependencies = { - nix = [ pkgs.ripgrep ]; - lua = [ - "plenary" - { - # We want a prebuilt version of this plugin - dir = pkgs.vimPlugins.telescope-fzf-native-nvim; - name = "telescope-fzf-native"; - } - ]; - }; - # }}} - # {{{ Keymaps - keys = - let - nmap = mapping: action: desc: { - inherit mapping desc; - action = "Telescope ${action} theme=ivy"; - }; - - findFilesByExtension = - mapping: extension: tag: - nmap "f${mapping}" "find_files find_command=rg,--files,--glob=**/*.${extension}" - "Find ${tag} files"; - in - [ - (nmap "" "find_files" "File finder [p]alette") - (nmap "d" "diagnostics" "[D]iagnostics") - (nmap "" "live_grep" "[F]ind in project") - (nmap "" "builtin" "[T]elescope pickers") - # {{{ Files by extension - (findFilesByExtension "tx" "tex" "[t]ex") - (findFilesByExtension "ts" "ts" "[t]ypescript") - (findFilesByExtension "ty" "typ" "[t]ypst") - (findFilesByExtension "l" "lua" "[l]ua") - (findFilesByExtension "n" "nix" "[n]ua") - (findFilesByExtension "p" "purs" "[p]urescript") - (findFilesByExtension "h" "hs" "[h]askell") - (findFilesByExtension "e" "elm" "[e]lm") - (findFilesByExtension "r" "rs" "[r]ust") - # }}} - ]; - # }}} - # {{{ Disable folds in telescope windows - config.autocmds = { - event = "FileType"; - pattern = "TelescopeResults"; - group = "TelescopeResultsDisableFolds"; - action.vim.opt.foldenable = false; - }; - # }}} - # {{{ Load fzf extension - config.callback = _: require "telescope" /load_extension "fzf"; - # }}} - # {{{ Options - opts.defaults.mappings.i."" = "which_key"; - opts.extensions.fzf = { - fuzzy = true; - override_generic_sorter = true; - override_file_sorter = true; - }; - # }}} - }; - # }}} - # {{{ dressing - dressing = { - package = "stevearc/dressing.nvim"; - - cond = blacklist "vscode"; - event = "VeryLazy"; - - opts = { - select.backend = [ - "nui" - "builtin" - "telescope" - ]; - input.insert_only = false; - }; - }; - # }}} - # }}} - # {{{ visual - # The line between `ui` and `visual` is a bit rought. I currenlty mostly judge - # it by vibe. - # {{{ indent-blankline - indent-blankline = { - package = "lukas-reineke/indent-blankline.nvim"; - main = "ibl"; - - cond = blacklist "vscode"; - event = "VeryLazy"; - config = true; - - # {{{ Keybinds - keys = - let - # {{{ List of fold-related keybinds - foldKeybinds = [ - "zo" - "zO" - "zc" - "zC" - "za" - "zA" - "zv" - "zx" - "zX" - "zm" - "zM" - "zr" - "zR" - ]; - in - # }}} - [ (nmap "si" "IBLToggle" "Toggle blankline indentation") ] - ++ (lib.forEach foldKeybinds ( - from: - nmap from "${from}IBLToggleIBLToggle" "Overriden ${from} (fold-related thing)" - )); - # }}}} - }; - # }}} - # {{{ live-command - # Live command preview for commands like :norm - live-command = { - package = "smjonas/live-command.nvim"; - version = "remote"; # https://github.com/smjonas/live-command.nvim/pull/29 - main = "live-command"; - - event = "CmdlineEnter"; - opts.commands.Norm.cmd = "norm"; - opts.commands.G.cmd = "g"; - - keys = keymap "v" "N" ":Norm " "Map lines in [n]ormal mode"; - }; - # }}} - # {{{ fidget - fidget = { - package = "j-hui/fidget.nvim"; - tag = "legacy"; - - cond = blacklist "vscode"; - event = "BufReadPre"; - config = true; - }; - # }}} - # {{{ treesitter - treesitter = { - # REASON: more grammars - dir = pkgs.symlinkJoin { - name = "treesitter-with-parsers"; - paths = [ - upkgs.vimPlugins.nvim-treesitter.withAllGrammars - upkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies - ]; - }; - # package = "nvim-treesitter/nvim-treesitter"; - main = "nvim-treesitter.configs"; - - dependencies.nix = [ pkgs.tree-sitter ]; - - cond = blacklist "vscode"; - event = "VeryLazy"; - - #{{{ Highlighting - opts.highlight = { - enable = true; - disable = [ "kotlin" ]; # This one seemed a bit broken - additional_vim_regex_highlighting = false; - }; - #}}} - - opts.indent.enable = true; - }; - # }}} - # }}} - # {{{ editing - # {{{ text navigation - # {{{ flash - flash = { - package = "folke/flash.nvim"; - - cond = blacklist "vscode"; - keys = - let - nmap = mode: mapping: action: desc: { - inherit mapping desc mode; - action = _: require "flash" /${action} none; - }; - in - [ - (nmap "nxo" "s" "jump" "Flash") - (nmap "nxo" "S" "treesitter" "Flash Treesitter") - (nmap "o" "r" "remote" "Remote Flash") - (nmap "ox" "R" "treesitter_search" "Treesitter Search") - (nmap "c" "" "toggle" "Toggle Flash Search") - ]; - - # Disable stuff like f/t/F/T - opts.modes.char.enabled = false; - }; - # }}} - # {{{ ftft (quickscope but written in lua) - ftft = { - package = "gukz/ftFT.nvim"; - - cond = blacklist "vscode"; - keys = [ - "f" - "F" - "t" - "T" - ]; - config = true; - }; - # }}} - # }}} - # {{{ clipboard-image - clipboard-image = { - package = "postfen/clipboard-image.nvim"; - - cond = blacklist "firenvim"; - cmd = "PasteImg"; - - keys = { - mapping = "p"; - action = "PasteImg"; - desc = "[P]aste image from clipboard"; - }; - - opts.default.img_name = importFrom ./plugins/clipboard-image.lua "img_name"; - opts.tex = { - img_dir = [ - "%:p:h" - "img" - ]; - affix = "\\includegraphics[width=\\textwidth]{%s}"; - }; - opts.typst = { - img_dir = [ - "%:p:h" - "img" - ]; - affix = ''#image("%s", width: 100)''; - }; - }; - # }}} - # {{{ lastplace - lastplace = { - package = "ethanholz/nvim-lastplace"; - - cond = blacklist "vscode"; - event = "BufReadPre"; - - opts.lastplace_ignore_buftype = [ - "quickfix" - "nofile" - "help" - ]; - }; - # }}} - # {{{ undotree - undotree = { - package = "mbbill/undotree"; - - cond = blacklist "vscode"; - cmd = "UndotreeToggle"; - keys = nmap "u" "UndoTreeToggle" "[U]ndo tree"; - }; - # }}} - # {{{ mini.ai - mini-ai = { - package = "echasnovski/mini.ai"; - name = "mini.ai"; - event = "VeryLazy"; - - opts = - _: # lazy, as we import mini.ai inside - let - balanced = from: [ - "%b${from}" - "^.().*().$" - ]; - in - { - custom_textobjects = { - b = balanced "()"; - B = balanced "{}"; - r = balanced "[]"; - v = [ - "⟨.-⟩" - "^⟨().*()⟩$" - ]; - q = balanced "\"\""; - Q = balanced "``"; - a = balanced "''"; - A = require "mini.ai" /gen_spec/argument none; - }; - }; - }; - # }}} - # {{{ mini.comment - mini-comment = { - package = "echasnovski/mini.comment"; - name = "mini.comment"; - - config = true; - keys = [ - { - mapping = "gc"; - mode = "nxv"; - } - "gcc" - ]; - }; - # }}} - # {{{ mini.surround - mini-surround = { - package = "echasnovski/mini.surround"; - name = "mini.surround"; - - keys = lib.flatten [ - # ^ doing the whole `flatten` thing to lie to my formatter - { - mapping = "s"; - mode = "nv"; - } - [ - "d" - "f" - "F" - "h" - "r" - ] - ]; - - # {{{ Keybinds - opts.mappings = { - add = "s"; # Add surrounding in Normal and Visul modes - delete = "d"; # Delete surrounding - find = "f"; # Find surrounding (to the right) - find_left = "F"; # Find surrounding (to the left) - highlight = "h"; # Highlight surrounding - replace = "r"; # Replace surrounding - update_n_lines = ""; # Update `n_lines` - }; - # }}} - # {{{ Custom surroundings - opts.custom_surroundings = - let - mk = balanced: input: left: right: { - input = [ - input - (if balanced then "^.%s*().-()%s*.$" else "^.().*().$") - ]; - output = { - inherit left right; - }; - }; - in - { - b = mk true "%b()" "(" ")"; - B = mk true "%b{}" "{" "}"; - r = mk true "%b[]" "[" "]"; - v = mk true "%b⟨⟩" "⟨" "⟩"; - q = mk false "\".-\"" "\"" "\""; - Q = mk false "`.-`" "`" "`"; - a = mk false "'.-'" "'" "'"; - }; - # }}} - }; - # }}} - # {{{ mini.operators - mini-operators = { - package = "echasnovski/mini.operators"; - name = "mini.operators"; - - config = true; - keys = - let - operator = key: [ - { - mapping = "g${key}"; - mode = "nv"; - } - "g${key}${key}" - ]; - in - lib.flatten [ - (operator "=") - (operator "x") - (operator "r") - (operator "s") - ]; - }; - # }}} - # {{{ mini.pairs - mini-pairs = { - package = "echasnovski/mini.pairs"; - name = "mini.pairs"; - - # We could specify all the generated bindings, but I don't think it's worth it - event = [ - "InsertEnter" - "CmdlineEnter" - ]; - }; - # }}} - # {{{ luasnip - # snippeting engine - luasnip = { - package = "L3MON4D3/LuaSnip"; - version = "v2"; - - cond = blacklist "vscode"; - config = - _: - do [ - (require "luasnip" /config/setup { - enable_autosnippets = true; - update_events = [ - "TextChanged" - "TextChangedI" - ]; - }) - - (require "luasnip.loaders.from_lua" /lazy_load { fs_event_providers.libuv = true; }) - ]; - - # {{{ Keybinds - keys = [ - { - mode = "i"; - expr = true; - mapping = ""; - action = - # lua - thunk '' - local luasnip = require("luasnip") - - if not luasnip.jumpable(1) then - return "" - end - - vim.schedule(function() - luasnip.jump(1) - end) - - return "" - ''; - desc = "Jump to next snippet tabstop"; - } - { - mode = "i"; - mapping = ""; - action = _: require "luasnip" /jump (-1); - desc = "Jump to previous snippet tabstop"; - } - { - mode = "is"; - mapping = ""; - action = "luasnip-prev-choice"; - desc = "Previous snippet node choice"; - } - { - mode = "is"; - mapping = ""; - action = "luasnip-next-choice"; - desc = "Next snippet node choice"; - } - ]; - # }}} - }; - # }}} - # {{{ miros - # snippeting generation language - miros = with inputs.miros.packages.${pkgs.system}; { - dir = miros-nvim; - dependencies.nix = [ miros ]; - - cond = blacklist "vscode"; - ft = "miros"; - - keys = { - mapping = "rm"; - action = - "!miros generate" - + " -i ${config.satellite.dev.path "home/features/neovim/snippets"}" - + " -o ${mirosSnippetCache}/luasnippets" - + " luasnip -r my.luasnip "; - desc = "[R]erun [m]iros"; - }; - }; - # }}} - # }}} - # {{{ ide - # {{{ lspconfig - lspconfig = { - # {{{ Nix dependencies - dependencies.nix = - with lib.lists; - with packedTargets; - ( - optionals web [ - pkgs.nodePackages.typescript - pkgs.nodePackages_latest.vscode-langservers-extracted - pkgs.nodePackages.typescript-language-server - ] - ++ optionals lua [ - pkgs.lua-language-server - pkgs.lua - ] - ++ optionals nix [ upkgs.nixd ] - ++ optionals latex [ - pkgs.texlab - pkgs.texlive.combined.scheme-full - ] - ++ optionals elm [ - pkgs.elmPackages.elm - pkgs.elmPackages.elm-format - pkgs.elmPackages.elm-language-server - ] - ++ optionals purescript [ - pkgs.purescript-language-server - pkgs.nodePackages.purs-tidy - ] - ++ optionals csharp [ pkgs.csharp-ls ] - ); - # }}} - dependencies.lua = [ - "neoconf" - "neodev" - ]; - package = "neovim/nvim-lspconfig"; - - cond = blacklist "vscode"; - event = "VeryLazy"; - - config = - _: - importFrom ./plugins/lspconfig.lua "config" { - # We handle formatting using null-ls and prettierd - tsserver.on_attach = client: '' - ${client}.server_capabilities.documentFormattingProvider = false - ''; - - purescriptls.settings.purescript = { - censorWarnings = [ - "UnusedName" - "ShadowedName" - "UserDefinedWarning" - ]; - formatter = "purs-tidy"; - }; - lua_ls.settings.Lua = { - format.enable = true; - # Do not send telemetry data containing a randomized but unique identifier - telemetry.enable = false; - }; - texlab.settings.texlab = { - build = { - args = [ - # Here by default: - "-pdf" - "-interaction=nonstopmode" - "-synctex=1" - "%f" - # Required for syntax highlighting inside the generated pdf apparently - "-shell-escape" - ]; - executable = "latexmk"; - forwardSearchAfter = true; - onSave = true; - }; - chktex = { - onOpenAndSave = true; - onEdit = true; - }; - }; - nixd.settings.nixd = - let - satellite = "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/satellite"; - hostname = "tethys"; # not sure how to get this dynamically in HM - in - { - formatting.command = [ ]; - diagnostic.suppress = [ - "sema-escaping-with" - "sema-extra-with" - ]; - nixpkgs.expr = ''import (builtins.getFlake "${satellite}").inputs.nixpkgs { }''; - options = { - nixos.expr = ''(builtins.getFlake "${satellite}").nixosConfigurations.${hostname}.options''; - home-manager.expr = ''(builtins.getFlake "${satellite}").homeConfigurations."${config.home.username}@${hostname}".options''; - }; - }; - cssls = { }; - jsonls = { }; - dhall_lsp_server = { }; - typst_lsp.exportPdf = "onType"; - elmls = { }; - csharp_ls = { }; - }; - }; - # }}} - # {{{ conform - conform = { - dependencies.lua = [ "lspconfig" ]; - dependencies.nix = - with lib.lists; - with packedTargets; - ( - [ pkgs.codespell ] - ++ optional lua pkgs.stylua - ++ optional python pkgs.ruff - ++ optionals web [ - pkgs.nodePackages_latest.prettier - pkgs.nodePackages_latest.prettier_d_slim - ] - ++ optionals nix [ pkgs.nixfmt-rfc-style ] - ); - package = "stevearc/conform.nvim"; - - cond = blacklist "vscode"; - event = "VeryLazy"; - - opts.format_on_save.lsp_fallback = true; - opts.formatters_by_ft = - let - prettier = [ - [ - "prettierd" - "prettier" - ] - ]; - in - { - "*" = [ - # "codespell" # this one causes issues sometimes - "trim_whitespace" - ]; - lua = [ "stylua" ]; - python = [ "ruff_format" ]; - - javascript = prettier; - typescript = prettier; - javascriptreact = prettier; - typescriptreact = prettier; - html = prettier; - nix = [ "nixfmt" ]; - css = prettier; - markdown = prettier; - }; - }; - # }}} - # {{{ neodev - neodev = { - package = "folke/neodev.nvim"; - config = true; - }; - # }}} - # {{{ neoconf - neoconf = { - package = "folke/neoconf.nvim"; - - cmd = "Neoconf"; - - # Provide autocomplete for every language server - opts.plugins.jsonls.configure_servers_only = false; - opts.import = { - vscode = true; # local .vscode/settings.json - coc = false; # global/local coc-settings.json - nlsp = false; # global/local nlsp-settings.nvim json settings - }; - }; - # }}} - # {{{ null-ls - null-ls = { - package = "jose-elias-alvarez/null-ls.nvim"; - dependencies.lua = [ "lspconfig" ]; - dependencies.nix = lib.lists.optional packedTargets.python pkgs.ruff; - - cond = blacklist "vscode"; - event = "VeryLazy"; - - opts = _: { sources = [ (require "null-ls" /builtins/diagnostics/ruff) ]; }; - }; - # }}} - # {{{ cmp - cmp = { - package = "hrsh7th/nvim-cmp"; - dependencies.lua = [ - # {{{ Completion sources - "hrsh7th/cmp-nvim-lsp" - "hrsh7th/cmp-buffer" - "hrsh7th/cmp-emoji" - "hrsh7th/cmp-cmdline" - "hrsh7th/cmp-path" - "saadparwaiz1/cmp_luasnip" - # }}} - "onsails/lspkind.nvim" # show icons in lsp completion menus - "luasnip" - ]; - - cond = blacklist "vscode"; - event = [ - "InsertEnter" - "CmdlineEnter" - ]; - config = importFrom ./plugins/cmp.lua "config"; - }; - # }}} - # {{{ neotest - neotest = { - package = "nvim-neotest/neotest"; - dependencies.lua = [ - # {{{ Adapters - "mrcjkb/neotest-haskell" - # }}} - "plenary" - "treesitter" - "nvim-neotest/nvim-nio" - ]; - - cond = blacklist "vscode"; - config = _: { - setup.neotest = { - status.virtual_text = true; - output.open_on_run = true; - adapters = [ - (require "neotest-haskell" { - build_tools = [ "stack" ]; - frameworks = [ "hspec" ]; - }) - ]; - }; - }; - - # {{{ Keybinds - keys = - let - nmap = - key: arg: desc: - nlib.nmap "t${key}" (thunk "require('neotest').run.${arg}") desc; - in - [ - (nmap "c" "run()" "Run [c]urrent [t]est") - (nmap "f" "run(vim.fn.expand('%'))" "Run [t]ests in [f]ile") - (nmap "s" "stop()" "Run [c]urrent [t]est") - ]; - # }}} - }; - # }}} - # }}} - # {{{ language support - # {{{ haskell support - haskell-tools = { - package = "mrcjkb/haskell-tools.nvim"; - dependencies.lua = [ "plenary" ]; - version = "^2"; - - cond = blacklist "vscode"; - ft = [ - "haskell" - "lhaskell" - "cabal" - "cabalproject" - ]; - - config.vim.g.haskell_tools = { - hls.settings.haskell = { - formattingProvider = "fourmolu"; - - # This seems to work better with custom preludes - # See this issue https://github.com/fourmolu/fourmolu/issues/357 - plugin.fourmolu.config.external = true; - }; - - # I think this wasn't showing certain docs as I expected (?) - tools.hover.enable = false; - }; - }; - # }}} - # {{{ rust support - # {{{ rust-tools - rust-tools = { - package = "simrat39/rust-tools.nvim"; - dependencies.nix = lib.lists.optionals packedTargets.rust [ - pkgs.rust-analyzer - pkgs.rustfmt - ]; - - cond = blacklist "vscode"; - ft = "rust"; - - opts.server.on_attach = tempestBufnr { - keys = { - mapping = "lc"; - action = "RustOpenCargo"; - desc = "Open [c]argo.toml"; - }; - }; - }; - # }}} - # {{{ crates - crates = { - package = "saecki/crates.nvim"; - dependencies.lua = [ "plenary" ]; - - cond = blacklist "vscode"; - event = "BufReadPost Cargo.toml"; - - # {{{ Set up null_ls source - opts.null_ls = { - enabled = true; - name = "crates"; - }; - # }}} - - config.autocmds = [ - # {{{ Load cmp source on insert - { - event = "InsertEnter"; - group = "CargoCmpSource"; - pattern = "Cargo.toml"; - action = _: require "cmp" /setup/buffer { sources = [ { name = "crates"; } ]; }; - } - # }}} - # {{{ Load keybinds on attach - { - event = "BufReadPost"; - group = "CargoKeybinds"; - pattern = "Cargo.toml"; - # # {{{ Register which-key info - # action.callback = contextThunk /* lua */ '' - # require("which-key").register({ - # ["lc"] = { - # name = "[l]ocal [c]rates", - # bufnr = context.bufnr - # }, - # }) - # ''; - # }}} - - action.keys = - _: - let - # {{{ Keymap helpers - nmap = mapping: action: desc: { - inherit mapping desc; - action = require "crates" /${action}; - }; - - keyroot = "lc"; - in - # }}} - # {{{ Keybinds - [ - (nmap "${keyroot}t" "toggle" "[c]rates [t]oggle") - (nmap "${keyroot}r" "reload" "[c]rates [r]efresh") - - (nmap "${keyroot}H" "open_homepage" "[c]rate [H]omephage") - (nmap "${keyroot}R" "open_repository" "[c]rate [R]epository") - (nmap "${keyroot}D" "open_documentation" "[c]rate [D]ocumentation") - (nmap "${keyroot}C" "open_crates_io" "[c]rate [C]rates.io") - - (nmap "${keyroot}v" "show_versions_popup" "[c]rate [v]ersions") - (nmap "${keyroot}f" "show_features_popup" "[c]rate [f]eatures") - (nmap "${keyroot}d" "show_dependencies_popup" "[c]rate [d]eps") - (nmap "K" "show_popup" "[c]rate popup") - ]; - # }}} - } - # }}} - ]; - }; - # }}} - # }}} - # {{{ lean support - lean = { - package = "Julian/lean.nvim"; - name = "lean"; - dependencies.lua = [ - "plenary" - "lspconfig" - ]; - - cond = blacklist "vscode"; - ft = "lean"; - - opts = { - abbreviations = { - builtin = true; - cmp = true; - }; - - lsp.capabilites = importFrom ./plugins/lspconfig.lua "capabilities"; - - lsp3 = false; # We don't want the lean 3 language server! - mappings = true; - }; - }; - # }}} - # {{{ idris support - idris = { - package = "ShinKage/idris2-nvim"; - name = "idris"; - dependencies.lua = [ - "nui" - "lspconfig" - ]; - - cond = blacklist "vscode"; - ft = [ - "idris2" - "lidris2" - "ipkg" - ]; - - opts = { - client.hover.use_split = true; - serve.on_attach = tempestBufnr { - # {{{ Keymaps - keys = - let - keymap = mapping: action: desc: { - inherit desc; - mapping = "i${mapping}"; - action = require "idris2.code_action" /${action}; - }; - in - [ - (keymap "C" "make_case" "Make [c]ase") - (keymap "L" "make_lemma" "Make [l]emma") - (keymap "c" "add_clause" "Add [c]lause") - (keymap "e" "expr_search" "[E]xpression search") - (keymap "d" "generate_def" "Generate [d]efinition") - (keymap "s" "case_split" "Case [s]plit") - (keymap "h" "refine_hole" "Refine [h]ole") - ]; - # }}} - }; - }; - }; - # }}} - # {{{ github actions - github-actions = { - package = "yasuhiroki/github-actions-yaml.vim"; - - cond = blacklist "vscode"; - ft = [ - "yml" - "yaml" - ]; - }; - # }}} - # {{{ typst support - typst = { - package = "kaarmu/typst.vim"; - dependencies.nix = lib.lists.optionals packedTargets.typst [ - upkgs.typst - upkgs.typst-lsp - upkgs.typstfmt - ]; - - cond = blacklist "vscode"; - ft = "typst"; - }; - # }}} - # {{{ purescript support - purescript = { - package = "purescript-contrib/purescript-vim"; - - cond = blacklist "vscode"; - ft = "purescript"; - }; - # }}} - # {{{ hyprland support - hyprland = { - package = "theRealCarneiro/hyprland-vim-syntax"; - - cond = blacklist "vscode"; - ft = "hypr"; - - init.autocmds = { - event = "BufRead"; - group = "DetectHyprlandConfig"; - pattern = "hyprland.conf"; - action.vim.opt.ft = "hypr"; - }; - }; - # }}} - # {{{ typescript support - # Required for yarn PNP to work - rzip = { - package = "lbrayner/vim-rzip"; - cond = blacklist "vscode"; - event = "VeryLazy"; - }; - # }}} - # {{{ djot support - djot = - let - djot = pkgs.fetchFromGitHub { - owner = "jgm"; - repo = "djot"; - rev = "2fec440ab7a75a06a1e18c29a00de64ec7c94b9d"; - sha256 = "1xy2x1qbmv1kjxdpj2pjm03d9l7qrl0wx96gn5m0lkfxkg766i7z"; - }; - in + desc = "Jump to next snippet tabstop"; + } { - dir = "${djot}/editors/vim"; - cond = blacklist "vscode"; - ft = "djot"; - - config.autocmds = { - event = "FileType"; - group = "UserDjotSettings"; - pattern = "djot"; - action.vim.opt.commentstring = ''{\% %s \%}''; - }; - }; - # }}} - # }}} - # {{{ external - # These plugins integrate neovim with external services - # {{{ wakatime - wakatime = { - package = "wakatime/vim-wakatime"; - dependencies.nix = [ pkgs.wakatime ]; - - cond = blacklist [ - "vscode" - "firenvim" - ]; - event = "VeryLazy"; - }; - # }}} - # {{{ discord rich presence - discord-rich-presence = { - package = "andweeb/presence.nvim"; - main = "presence"; - - cond = blacklist [ - "vscode" - "firenvim" - ]; - event = "VeryLazy"; - config = true; - }; - # }}} - # {{{ gitlinker - # generate permalinks for code - gitlinker = rec { - package = "ruifm/gitlinker.nvim"; - dependencies.lua = [ "plenary" ]; - - cond = blacklist [ - "vscode" - "firenvim" - ]; - opts.mappings = "yg"; - keys = { - mapping = opts.mappings; - desc = "[y]ank [g]it permalink"; - }; - }; - # }}} - # {{{ obsidian - obsidian = - let - dateFormat = "%Y-%m-%d"; - in + mode = "i"; + mapping = ""; + action = _: require "luasnip" /jump (-1); + desc = "Jump to previous snippet tabstop"; + } { - package = "epwalsh/obsidian.nvim"; - dependencies.lua = [ "plenary" ]; - - event = "VeryLazy"; - cond = [ - (blacklist [ - "vscode" - "firenvim" - ]) - ( - # lua - lua "vim.loop.cwd() == ${encode obsidianVault}" - ) - ]; - - config.keys = - let - nmap = mapping: action: desc: { - inherit mapping desc; - action = "Obsidian${action}"; - }; - in - [ - (nmap "" "QuickSwitch" "[o]pen note") - (nmap "ot" "Today" "[t]oday's note") - (nmap "oy" "Yesterday" "[y]esterday's note") - (nmap "oi" "Template" "[i]nstantiate template") - (nmap "on" "Template New note.md" "new [n]ote template") - (nmap "od" "Template New note.md" "new [d]ream template") - ]; - - opts = { - dir = obsidianVault; - notes_subdir = "chaos"; - - daily_notes = { - folder = "daily"; - date_format = dateFormat; - template = "New daily note.md"; - }; - - templates = { - subdir = "templates"; - date_format = dateFormat; - time_format = "%H:%M"; - }; - - completion = { - nvim_cmp = true; - min_chars = 2; - }; - - new_notes_location = "current_dir"; - mappings = { }; - disable_frontmatter = true; - }; - }; - # }}} - # {{{ navigator - navigator = { - package = "numToStr/Navigator.nvim"; - cond = blacklist [ - "vscode" - "firenvim" - "neovide" - ]; - - config = true; - keys = [ - (nmap "" "NavigatorLeft" "Navigate left") - (nmap "" "NavigatorDown" "Navigate down") - (nmap "" "NavigatorUp" "Navigate up") - (nmap "" "NavigatorRight" "Navigate right") - ]; - }; - # }}} + mode = "is"; + mapping = ""; + action = "luasnip-prev-choice"; + desc = "Previous snippet node choice"; + } + { + mode = "is"; + mapping = ""; + action = "luasnip-next-choice"; + desc = "Next snippet node choice"; + } + ]; # }}} }; # }}} - } - ) - ); + # {{{ miros + # snippeting generation language + miros = with inputs.miros.packages.${pkgs.system}; { + dir = miros-nvim; + dependencies.nix = [ miros ]; + + cond = blacklist "vscode"; + ft = "miros"; + + keys = { + mapping = "rm"; + action = + "!miros generate" + + " -i ${config.satellite.dev.path "home/features/neovim/snippets"}" + + " -o ${mirosSnippetCache}/luasnippets" + + " luasnip -r my.luasnip "; + desc = "[R]erun [m]iros"; + }; + }; + # }}} + # }}} + # {{{ ide + # {{{ lspconfig + lspconfig = { + # {{{ Nix dependencies + dependencies.nix = + with lib.lists; + with packedTargets; + ( + optionals web [ + pkgs.nodePackages.typescript + pkgs.nodePackages_latest.vscode-langservers-extracted + pkgs.nodePackages.typescript-language-server + ] + ++ optionals lua [ + pkgs.lua-language-server + pkgs.lua + ] + ++ optionals nix [ upkgs.nixd ] + ++ optionals latex [ + pkgs.texlab + pkgs.texlive.combined.scheme-full + ] + ++ optionals elm [ + pkgs.elmPackages.elm + pkgs.elmPackages.elm-format + pkgs.elmPackages.elm-language-server + ] + ++ optionals purescript [ + pkgs.purescript-language-server + pkgs.nodePackages.purs-tidy + ] + ++ optionals csharp [ pkgs.csharp-ls ] + ); + # }}} + dependencies.lua = [ + "neoconf" + "neodev" + ]; + package = "neovim/nvim-lspconfig"; + + cond = blacklist "vscode"; + event = "VeryLazy"; + + config = + _: + importFrom ./plugins/lspconfig.lua "config" { + # We handle formatting using null-ls and prettierd + tsserver.on_attach = client: '' + ${client}.server_capabilities.documentFormattingProvider = false + ''; + + purescriptls.settings.purescript = { + censorWarnings = [ + "UnusedName" + "ShadowedName" + "UserDefinedWarning" + ]; + formatter = "purs-tidy"; + }; + lua_ls.settings.Lua = { + format.enable = true; + # Do not send telemetry data containing a randomized but unique identifier + telemetry.enable = false; + }; + texlab.settings.texlab = { + build = { + args = [ + # Here by default: + "-pdf" + "-interaction=nonstopmode" + "-synctex=1" + "%f" + # Required for syntax highlighting inside the generated pdf apparently + "-shell-escape" + ]; + executable = "latexmk"; + forwardSearchAfter = true; + onSave = true; + }; + chktex = { + onOpenAndSave = true; + onEdit = true; + }; + }; + nixd.settings.nixd = + let + satellite = "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/satellite"; + hostname = "tethys"; # not sure how to get this dynamically in HM + in + { + formatting.command = [ ]; + diagnostic.suppress = [ + "sema-escaping-with" + "sema-extra-with" + ]; + nixpkgs.expr = ''import (builtins.getFlake "${satellite}").inputs.nixpkgs { }''; + options = { + nixos.expr = ''(builtins.getFlake "${satellite}").nixosConfigurations.${hostname}.options''; + home-manager.expr = ''(builtins.getFlake "${satellite}").homeConfigurations."${config.home.username}@${hostname}".options''; + }; + }; + cssls = { }; + jsonls = { }; + dhall_lsp_server = { }; + typst_lsp.exportPdf = "onType"; + elmls = { }; + csharp_ls = { }; + }; + }; + # }}} + # {{{ conform + conform = { + dependencies.lua = [ "lspconfig" ]; + dependencies.nix = + with lib.lists; + with packedTargets; + ( + [ pkgs.codespell ] + ++ optional lua pkgs.stylua + ++ optional python pkgs.ruff + ++ optionals web [ + pkgs.nodePackages_latest.prettier + pkgs.nodePackages_latest.prettier_d_slim + ] + ++ optionals nix [ pkgs.nixfmt-rfc-style ] + ); + package = "stevearc/conform.nvim"; + + cond = blacklist "vscode"; + event = "VeryLazy"; + + opts.format_on_save.lsp_fallback = true; + opts.formatters_by_ft = + let + prettier = [ + [ + "prettierd" + "prettier" + ] + ]; + in + { + "*" = [ + # "codespell" # this one causes issues sometimes + "trim_whitespace" + ]; + lua = [ "stylua" ]; + python = [ "ruff_format" ]; + + javascript = prettier; + typescript = prettier; + javascriptreact = prettier; + typescriptreact = prettier; + html = prettier; + nix = [ "nixfmt" ]; + css = prettier; + markdown = prettier; + }; + }; + # }}} + # {{{ neodev + neodev = { + package = "folke/neodev.nvim"; + config = true; + }; + # }}} + # {{{ neoconf + neoconf = { + package = "folke/neoconf.nvim"; + + cmd = "Neoconf"; + + # Provide autocomplete for every language server + opts.plugins.jsonls.configure_servers_only = false; + opts.import = { + vscode = true; # local .vscode/settings.json + coc = false; # global/local coc-settings.json + nlsp = false; # global/local nlsp-settings.nvim json settings + }; + }; + # }}} + # {{{ null-ls + null-ls = { + package = "jose-elias-alvarez/null-ls.nvim"; + dependencies.lua = [ "lspconfig" ]; + dependencies.nix = lib.lists.optional packedTargets.python pkgs.ruff; + + cond = blacklist "vscode"; + event = "VeryLazy"; + + opts = _: { sources = [ (require "null-ls" /builtins/diagnostics/ruff) ]; }; + }; + # }}} + # {{{ cmp + cmp = { + package = "hrsh7th/nvim-cmp"; + dependencies.lua = [ + # {{{ Completion sources + "hrsh7th/cmp-nvim-lsp" + "hrsh7th/cmp-buffer" + "hrsh7th/cmp-emoji" + "hrsh7th/cmp-cmdline" + "hrsh7th/cmp-path" + "saadparwaiz1/cmp_luasnip" + # }}} + "onsails/lspkind.nvim" # show icons in lsp completion menus + "luasnip" + ]; + + cond = blacklist "vscode"; + event = [ + "InsertEnter" + "CmdlineEnter" + ]; + config = importFrom ./plugins/cmp.lua "config"; + }; + # }}} + # {{{ neotest + neotest = { + package = "nvim-neotest/neotest"; + dependencies.lua = [ + # {{{ Adapters + "mrcjkb/neotest-haskell" + # }}} + "plenary" + "treesitter" + "nvim-neotest/nvim-nio" + ]; + + cond = blacklist "vscode"; + config = _: { + setup.neotest = { + status.virtual_text = true; + output.open_on_run = true; + adapters = [ + (require "rustaceanvim.neotest") + (require "neotest-haskell" { + build_tools = [ "stack" ]; + frameworks = [ "hspec" ]; + }) + ]; + }; + }; + + # {{{ Keybinds + keys = + let + nmap = + key: arg: desc: + nlib.nmap "t${key}" (thunk "require('neotest').run.${arg}") desc; + in + [ + (nmap "c" "run()" "Run [c]urrent [t]est") + (nmap "f" "run(vim.fn.expand('%'))" "Run [t]ests in [f]ile") + (nmap "s" "stop()" "Run [c]urrent [t]est") + ]; + # }}} + }; + # }}} + # }}} + # {{{ language support + # {{{ haskell support + haskell-tools = { + package = "mrcjkb/haskell-tools.nvim"; + dependencies.lua = [ "plenary" ]; + version = "^2"; + + cond = blacklist "vscode"; + ft = [ + "haskell" + "lhaskell" + "cabal" + "cabalproject" + ]; + + config.vim.g.haskell_tools = { + hls.settings.haskell = { + formattingProvider = "fourmolu"; + + # This seems to work better with custom preludes + # See this issue https://github.com/fourmolu/fourmolu/issues/357 + plugin.fourmolu.config.external = true; + }; + + # I think this wasn't showing certain docs as I expected (?) + tools.hover.enable = false; + }; + }; + # }}} + # {{{ rust support + # {{{ rustacean + rustacean = { + package = "mrcjkb/rustaceanvim"; + dependencies.nix = lib.lists.optionals packedTargets.rust [ + pkgs.rust-analyzer + pkgs.rustfmt + ]; + + cond = blacklist "vscode"; + lazy = false; # This plugin is already lazy + + config.autocmds = { + group = "RustaceanSettings"; + event = "FileType"; + pattern = "rs"; + action.keys = { + mapping = "lc"; + action = "RustLsp openCargo"; + desc = "Open [c]argo.toml"; + }; + }; + }; + # }}} + # {{{ crates + crates = { + package = "saecki/crates.nvim"; + dependencies.lua = [ "plenary" ]; + + cond = blacklist "vscode"; + event = "BufReadPost Cargo.toml"; + + # {{{ Set up null_ls source + opts.null_ls = { + enabled = true; + name = "crates"; + }; + # }}} + + config.autocmds = [ + # {{{ Load cmp source on insert + { + event = "InsertEnter"; + group = "CargoCmpSource"; + pattern = "Cargo.toml"; + action = _: require "cmp" /setup/buffer { sources = [ { name = "crates"; } ]; }; + } + # }}} + # {{{ Load keybinds on attach + { + event = "BufReadPost"; + group = "CargoKeybinds"; + pattern = "Cargo.toml"; + # # {{{ Register which-key info + # action.callback = contextThunk /* lua */ '' + # require("which-key").register({ + # ["lc"] = { + # name = "[l]ocal [c]rates", + # bufnr = context.bufnr + # }, + # }) + # ''; + # }}} + + action.keys = + _: + let + # {{{ Keymap helpers + nmap = mapping: action: desc: { + inherit mapping desc; + action = require "crates" /${action}; + }; + + keyroot = "lc"; + in + # }}} + # {{{ Keybinds + [ + (nmap "${keyroot}t" "toggle" "[c]rates [t]oggle") + (nmap "${keyroot}r" "reload" "[c]rates [r]efresh") + + (nmap "${keyroot}H" "open_homepage" "[c]rate [H]omephage") + (nmap "${keyroot}R" "open_repository" "[c]rate [R]epository") + (nmap "${keyroot}D" "open_documentation" "[c]rate [D]ocumentation") + (nmap "${keyroot}C" "open_crates_io" "[c]rate [C]rates.io") + + (nmap "${keyroot}v" "show_versions_popup" "[c]rate [v]ersions") + (nmap "${keyroot}f" "show_features_popup" "[c]rate [f]eatures") + (nmap "${keyroot}d" "show_dependencies_popup" "[c]rate [d]eps") + (nmap "K" "show_popup" "[c]rate popup") + ]; + # }}} + } + # }}} + ]; + }; + # }}} + # }}} + # {{{ lean support + lean = { + package = "Julian/lean.nvim"; + name = "lean"; + dependencies.lua = [ + "plenary" + "lspconfig" + ]; + + cond = blacklist "vscode"; + ft = "lean"; + + opts = { + abbreviations = { + builtin = true; + cmp = true; + }; + + lsp.capabilites = importFrom ./plugins/lspconfig.lua "capabilities"; + + lsp3 = false; # We don't want the lean 3 language server! + mappings = true; + }; + }; + # }}} + # {{{ idris support + idris = { + package = "ShinKage/idris2-nvim"; + name = "idris"; + dependencies.lua = [ + "nui" + "lspconfig" + ]; + + cond = blacklist "vscode"; + ft = [ + "idris2" + "lidris2" + "ipkg" + ]; + + opts = { + client.hover.use_split = true; + serve.on_attach = tempestBufnr { + # {{{ Keymaps + keys = + let + keymap = mapping: action: desc: { + inherit desc; + mapping = "i${mapping}"; + action = require "idris2.code_action" /${action}; + }; + in + [ + (keymap "C" "make_case" "Make [c]ase") + (keymap "L" "make_lemma" "Make [l]emma") + (keymap "c" "add_clause" "Add [c]lause") + (keymap "e" "expr_search" "[E]xpression search") + (keymap "d" "generate_def" "Generate [d]efinition") + (keymap "s" "case_split" "Case [s]plit") + (keymap "h" "refine_hole" "Refine [h]ole") + ]; + # }}} + }; + }; + }; + # }}} + # {{{ github actions + github-actions = { + package = "yasuhiroki/github-actions-yaml.vim"; + + cond = blacklist "vscode"; + ft = [ + "yml" + "yaml" + ]; + }; + # }}} + # {{{ typst support + typst = { + package = "kaarmu/typst.vim"; + dependencies.nix = lib.lists.optionals packedTargets.typst [ + upkgs.typst + upkgs.typst-lsp + upkgs.typstfmt + ]; + + cond = blacklist "vscode"; + ft = "typst"; + }; + # }}} + # {{{ purescript support + purescript = { + package = "purescript-contrib/purescript-vim"; + + cond = blacklist "vscode"; + ft = "purescript"; + }; + # }}} + # {{{ hyprland support + hyprland = { + package = "theRealCarneiro/hyprland-vim-syntax"; + + cond = blacklist "vscode"; + ft = "hypr"; + + init.autocmds = { + event = "BufRead"; + group = "DetectHyprlandConfig"; + pattern = "hyprland.conf"; + action.vim.opt.ft = "hypr"; + }; + }; + # }}} + # {{{ typescript support + # Required for yarn PNP to work + rzip = { + package = "lbrayner/vim-rzip"; + cond = blacklist "vscode"; + event = "VeryLazy"; + }; + # }}} + # {{{ djot support + djot = + let + djot = pkgs.fetchFromGitHub { + owner = "jgm"; + repo = "djot"; + rev = "2fec440ab7a75a06a1e18c29a00de64ec7c94b9d"; + sha256 = "1xy2x1qbmv1kjxdpj2pjm03d9l7qrl0wx96gn5m0lkfxkg766i7z"; + }; + in + { + dir = "${djot}/editors/vim"; + cond = blacklist "vscode"; + ft = "djot"; + + config.autocmds = { + event = "FileType"; + group = "UserDjotSettings"; + pattern = "djot"; + action.vim.opt.commentstring = ''{\% %s \%}''; + }; + }; + # }}} + # }}} + # {{{ external + # These plugins integrate neovim with external services + # {{{ wakatime + wakatime = { + package = "wakatime/vim-wakatime"; + dependencies.nix = [ pkgs.wakatime ]; + + cond = blacklist [ + "vscode" + "firenvim" + ]; + event = "VeryLazy"; + }; + # }}} + # {{{ discord rich presence + discord-rich-presence = { + package = "andweeb/presence.nvim"; + main = "presence"; + + cond = blacklist [ + "vscode" + "firenvim" + ]; + event = "VeryLazy"; + config = true; + }; + # }}} + # {{{ gitlinker + # generate permalinks for code + gitlinker = rec { + package = "ruifm/gitlinker.nvim"; + dependencies.lua = [ "plenary" ]; + + cond = blacklist [ + "vscode" + "firenvim" + ]; + opts.mappings = "yg"; + keys = { + mapping = opts.mappings; + desc = "[y]ank [g]it permalink"; + }; + }; + # }}} + # {{{ obsidian + obsidian = + let + dateFormat = "%Y-%m-%d"; + in + { + package = "epwalsh/obsidian.nvim"; + dependencies.lua = [ "plenary" ]; + + event = "VeryLazy"; + cond = [ + (blacklist [ + "vscode" + "firenvim" + ]) + ( + # lua + lua "vim.loop.cwd() == ${encode obsidianVault}" + ) + ]; + + config.keys = + let + nmap = mapping: action: desc: { + inherit mapping desc; + action = "Obsidian${action}"; + }; + in + [ + (nmap "" "QuickSwitch" "[o]pen note") + (nmap "ot" "Today" "[t]oday's note") + (nmap "oy" "Yesterday" "[y]esterday's note") + (nmap "oi" "Template" "[i]nstantiate template") + (nmap "on" "Template New note.md" "new [n]ote template") + (nmap "od" "Template New note.md" "new [d]ream template") + ]; + + opts = { + dir = obsidianVault; + notes_subdir = "chaos"; + + daily_notes = { + folder = "daily"; + date_format = dateFormat; + template = "New daily note.md"; + }; + + templates = { + subdir = "templates"; + date_format = dateFormat; + time_format = "%H:%M"; + }; + + completion = { + nvim_cmp = true; + min_chars = 2; + }; + + new_notes_location = "current_dir"; + mappings = { }; + disable_frontmatter = true; + }; + }; + # }}} + # {{{ navigator + navigator = { + package = "numToStr/Navigator.nvim"; + cond = blacklist [ + "vscode" + "firenvim" + "neovide" + ]; + + config = true; + keys = [ + (nmap "" "NavigatorLeft" "Navigate left") + (nmap "" "NavigatorDown" "Navigate down") + (nmap "" "NavigatorUp" "Navigate up") + (nmap "" "NavigatorRight" "Navigate right") + ]; + }; + # }}} + # }}} + }; + # }}} + }; + # {{{ extraRuntime # Experimental nix module generation - generatedConfig = (config.satellite.lib.lua.writeFile "lua/nix" "init" generated.lua); + generatedConfig = config.satellite.lib.lua.writeFile "lua/nix" "init" generated.lua; extraRuntime = lib.concatStringsSep "," [ generatedConfig mirosSnippetCache "${pkgs.vimPlugins.lazy-nvim}" ]; - # }}} # {{{ Client wrapper # Wraps a neovim client, providing the dependencies diff --git a/home/features/neovim/snippets/tex.miros b/home/features/neovim/snippets/tex.miros index 6bfe8ce..a1f8d07 100644 --- a/home/features/neovim/snippets/tex.miros +++ b/home/features/neovim/snippets/tex.miros @@ -55,10 +55,10 @@ block text pattern ([Ll]et) name definition - snip @1 \$$1 = $2\$ + snip @0 \$$1 = $2\$ @0 block auto - string im + string $ name inline math snip \$$1\$$0 @@ -92,11 +92,18 @@ block math $7 & $8 & $9 \end{@matenv} - for operator <- @⟨eq,neq,defas,leq,geq,lt,gt,iip,iib,iff⟩ - for symbol <- @⟨@operator:=,\neq,\coloneq,\leq,\geq,<,>,\implies,\impliedby,\iff⟩ + for createabbr <- @⟨false,true⟩ + for operator <- @⟨@createabbr: + @⟨eq,lt,gt⟩, + @⟨neq,defas,leq,geq,iip,iib,iff⟩ + ⟩ + for symbol <- @⟨@createabbr: + @⟨@operator:=,<,>⟩, + @⟨@operator:\neq,\coloneq,\leq,\geq,\implies,\impliedby,\iff⟩ + ⟩ block auto - abbr @operator @symbol + abbr @⟨@createabbr:op-@operator,@operator⟩ @symbol string a@operator name align at @operator @@ -177,6 +184,7 @@ block math abbr frl \forall abbr exs \exists + abbr iin \in abbr nin \not\in abbr ccup \cup abbr ccap \cap @@ -187,9 +195,8 @@ block math abbr vsm \vecspace abbr oball \ball - for noperator <- @⟨ordop,land,lor⟩ - string @noperator - snip \\@noperator + for noperator <- @⟨ordop,land,lor,equiv,pmod⟩ + abbr @noperator \\@noperator for operator <- @⟨overline,hat,bar,abs,norm,prob,diprod,sin,cos,sqrt,ln,lrb,zmod,gen,diam,prob⟩ string @operator @@ -247,10 +254,10 @@ block math name limit to @limtarget snip \lim_{$1 \to @limtargetsymbol} $0 - string dint + string intd name definite integral snip \int_{$|1⟨$1,-\infty$1⟩}^$|2⟨{$2},\infty$2⟩ $3 \dif $0 - string iint + string inti name indefinite integral snip \int $1 \dif $0 diff --git a/home/features/persistence.nix b/home/features/persistence.nix index b8360af..f31434a 100644 --- a/home/features/persistence.nix +++ b/home/features/persistence.nix @@ -113,6 +113,16 @@ "${config.xdg.configHome}/Signal" # Why tf does signal store it's state here 💀 ]; # }}} + # {{{ What's app + satellite.persistence.at.state.apps.whatsapp.directories = [ + "${config.xdg.configHome}/whatsapp-for-linux" + "${config.xdg.stateHome}/whatsapp-for-linux" + ]; + + satellite.persistence.at.cache.apps.whatsapp.directories = [ + "${config.xdg.cacheHome}/whatsapp-for-linux" + ]; + # }}} # {{{ Lutris # TODO: there might be more to cache in .cache/lutris satellite.persistence.at.state.apps.lutris.directories = [ diff --git a/hosts/nixos/calypso/default.nix b/hosts/nixos/calypso/default.nix index b200274..63631a5 100644 --- a/hosts/nixos/calypso/default.nix +++ b/hosts/nixos/calypso/default.nix @@ -53,6 +53,9 @@ programs.kdeconnect.enable = true; programs.firejail.enable = true; # }}} + # {{{ SSH keys + users.users.pilot.openssh.authorizedKeys.keyFiles = [ ../tethys/keys/id_ed25519.pub ]; + # }}} satellite.pilot.name = "moon"; boot.loader.systemd-boot.enable = true; diff --git a/hosts/nixos/calypso/filesystems/partitions.nix b/hosts/nixos/calypso/filesystems/partitions.nix index 590180c..5a871d8 100644 --- a/hosts/nixos/calypso/filesystems/partitions.nix +++ b/hosts/nixos/calypso/filesystems/partitions.nix @@ -62,19 +62,13 @@ # {{{ /persist/data "persist-data" = { mountpoint = "/persist/data"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; + mountOptions = [ "compress=zstd" ]; }; # }}} # {{{ /persist/state "persist-state" = { mountpoint = "/persist/state"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; + mountOptions = [ "compress=zstd" ]; }; # }}} # {{{ /local/nix diff --git a/hosts/nixos/common/optional/services/restic/default.nix b/hosts/nixos/common/optional/services/restic/default.nix index 739f9d7..b421491 100644 --- a/hosts/nixos/common/optional/services/restic/default.nix +++ b/hosts/nixos/common/optional/services/restic/default.nix @@ -74,4 +74,9 @@ in }; # }}} }; + + environment.persistence."/persist/local/cache".directories = [ + "/var/cache/restic-backups-data" + "/var/cache/restic-backups-state" + ]; } diff --git a/hosts/nixos/common/optional/services/syncthing.nix b/hosts/nixos/common/optional/services/syncthing.nix index ba4c1eb..25a47b3 100644 --- a/hosts/nixos/common/optional/services/syncthing.nix +++ b/hosts/nixos/common/optional/services/syncthing.nix @@ -18,7 +18,7 @@ in overrideFolders = true; settings = { - # {{{ Device ids + # {{{ Device ids devices = { enceladus.id = "QWOAERM-V2FNXPI-TB7NFUS-LKW7JTB-IZY4OEZ-FYDPJNP-6IKPW4Y-YREXDQM"; lapetus.id = "VVHM7RC-ZSDOZJI-EGBIJR4-2DOGAXG-OEJZWSH-OYUK5XT-7CDMWSL-3AVM2AZ"; diff --git a/hosts/nixos/common/optional/users/pilot.nix b/hosts/nixos/common/optional/users/pilot.nix index d56e292..d6abfaf 100644 --- a/hosts/nixos/common/optional/users/pilot.nix +++ b/hosts/nixos/common/optional/users/pilot.nix @@ -21,6 +21,9 @@ # Configure users through nix only mutableUsers = false; + # Sync up root and `pilot` shell + users.root.shell = config.users.users.pilot.shell; + # {{{ Create pilot user users.pilot = { inherit (config.satellite.pilot) name; @@ -46,27 +49,6 @@ hashedPasswordFile = config.sops.secrets.pilot_password.path; shell = pkgs.fish; - - # {{{ Authorize ssh keys - openssh.authorizedKeys.keyFiles = - let - # Record containing all the hosts - hosts = outputs.nixosConfigurations; - - # Function from hostname to relative path to public ssh key - idKey = host: ../../${host}/keys/id_ed25519.pub; - in - lib.pipe hosts [ - # attrsetof host -> attrsetof path - (builtins.mapAttrs (name: _: idKey name)) # string -> host -> path - - # attrsetof path -> path[] - builtins.attrValues - - # path[] -> path[] - (builtins.filter builtins.pathExists) - ]; - # }}} }; # }}} }; diff --git a/hosts/nixos/iso/default.nix b/hosts/nixos/iso/default.nix index 4ffc2a3..b5907a7 100644 --- a/hosts/nixos/iso/default.nix +++ b/hosts/nixos/iso/default.nix @@ -43,10 +43,14 @@ ]; }; # }}} - - # Tell sops-nix to use the hermes keys for decrypting secrets - sops.age.sshKeyPaths = [ "/hermes/secrets/hermes/ssh_host_ed25519_key" ]; - + # {{{ SSH keys + users.users.pilot.openssh.authorizedKeys.keyFiles = [ + ../calypso/keys/id_ed25519.pub + ../lapetus/keys/id_ed25519.pub + ../tethys/keys/id_ed25519.pub + ]; + # }}} + # {{{ Install some packages environment.systemPackages = let cloneConfig = pkgs.writeShellScriptBin "liftoff" '' @@ -60,6 +64,10 @@ neovim # Text editor cloneConfig # Clones my nixos config from github ]; + # }}} + + # Tell sops-nix to use the hermes keys for decrypting secrets + sops.age.sshKeyPaths = [ "/hermes/secrets/hermes/ssh_host_ed25519_key" ]; # Fast but bad compression # isoImage.squashfsCompression = "gzip -Xcompression-level 1"; diff --git a/hosts/nixos/lapetus/default.nix b/hosts/nixos/lapetus/default.nix index 258a2b6..741fda2 100644 --- a/hosts/nixos/lapetus/default.nix +++ b/hosts/nixos/lapetus/default.nix @@ -26,7 +26,7 @@ ./services/grafana.nix ./services/guacamole ./services/homer.nix - ./services/intray.nix + # ./services/intray.nix ./services/invidious.nix ./services/jellyfin.nix ./services/jupyter.nix @@ -65,6 +65,15 @@ } ]; # }}} + # {{{ SSH keys + users.users.pilot.openssh.authorizedKeys.keyFiles = [ + ../calypso/keys/id_ed25519.pub + ../tethys/keys/id_ed25519.pub + ]; + + users.users.root.openssh.authorizedKeys.keyFiles = + config.users.users.pilot.openssh.authorizedKeys.keyFiles; + # }}} boot.loader.systemd-boot.enable = true; } diff --git a/hosts/nixos/tethys/default.nix b/hosts/nixos/tethys/default.nix index 3e30e90..993fcf2 100644 --- a/hosts/nixos/tethys/default.nix +++ b/hosts/nixos/tethys/default.nix @@ -59,4 +59,7 @@ # } ]; # }}} + # {{{ SSH keys + users.users.pilot.openssh.authorizedKeys.keyFiles = [ ../calypso/keys/id_ed25519.pub ]; + # }}} }