diff --git a/lib/mkNeovim.nix b/lib/mkNeovim.nix index 3922e43..d1d06df 100644 --- a/lib/mkNeovim.nix +++ b/lib/mkNeovim.nix @@ -4,9 +4,10 @@ overlays, inputs, }: -user: system: +configPath: system: let darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; + user = builtins.elemAt (builtins.split "/" configPath) 0; host = { inherit darwin; @@ -19,7 +20,7 @@ in (inputs.nvf.lib.neovimConfiguration { pkgs = nixpkgs.legacyPackages.${system}; modules = builtins.filter (f: f != null) [ - (../users + ("/" + user + "/vim.nix")) + (../users + ("/" + configPath + "/vim.nix")) ../modules/neovim ]; extraSpecialArgs = { diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index 84be6e1..eca66b0 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -1,9 +1,12 @@ { config, + pkgs, lib, - host, ... }: +let + allowExe = config.shared.allowExe; +in { # based on default options from upstream: # https://github.com/NotAShelf/nvf/blob/main/configuration.nix @@ -13,7 +16,7 @@ # # override level 999 is used to not conflict with mkDefault as used by nvf. # which allows user configurations to disable/override anything here. - vim = lib.mkOverride 999 { + config.vim = lib.mkOverride 999 { theme = { enable = true; }; @@ -34,7 +37,7 @@ }; lsp = { # Must be enabled for language modules to hook into the LSP API. - enable = true; + enable = allowExe; formatOnSave = true; # show errors inline # https://github.com/folke/trouble.nvim @@ -48,30 +51,43 @@ }; debugger = { nvim-dap = { - enable = true; + enable = allowExe; ui.enable = true; }; }; languages = { enableFormat = true; - enableTreesitter = true; + enableTreesitter = allowExe; enableExtraDiagnostics = true; # sort-lines: on - assembly.enable = true; - bash.enable = true; - clang.enable = true; - css.enable = true; - html.enable = true; - nix.enable = true; - rust.crates.enable = true; - rust.enable = true; - ts.enable = true; - zig.enable = true; + assembly.enable = allowExe; + bash.enable = allowExe; + clang.enable = allowExe; + css.enable = allowExe; + html.enable = allowExe; + nix.enable = allowExe; + rust.crates.enable = allowExe; + rust.enable = allowExe; + ts.enable = allowExe; + zig.enable = allowExe; # sort-lines: off + ts.format.enable = false; # deno fmt is enabled elsewhere nix.format.type = "nixfmt"; # looks so much nicer }; + formatter.conform-nvim = { + enable = true; + setupOpts.formatters_by_ft = { + typescript = [ "deno_fmt" ]; + typescriptreact = [ "deno_fmt" ]; + javascript = [ "deno_fmt" ]; + javascriptreact = [ "deno_fmt" ]; + }; + setupOpts.formatters.deno_fmt = { + command = lib.meta.getExe pkgs.deno; + }; + }; filetree = { neo-tree = { enable = true; @@ -81,7 +97,7 @@ nvimBufferline.enable = true; }; autocomplete = { - blink-cmp.enable = true; + blink-cmp.enable = allowExe; }; statusline = { lualine = { @@ -132,8 +148,8 @@ todo-comments.enable = true; }; git = { - enable = true; - gitsigns.enable = true; + enable = allowExe; + gitsigns.enable = allowExe; gitsigns.codeActions.enable = false; # throws an annoying debug message }; }; diff --git a/users/chloe/configuration.nix b/users/chloe/configuration.nix index 4f47f34..ca99126 100644 --- a/users/chloe/configuration.nix +++ b/users/chloe/configuration.nix @@ -4,8 +4,6 @@ # packages for all machines environment.systemPackages = with pkgs; [ ]; - # services for all machines - services.karabiner-elements.enable = true; # configuration for shared modules. # all custom options in 'shared' for clarity. diff --git a/users/chloe/home.nix b/users/chloe/home.nix index 5aa9dc9..5bcabdf 100644 --- a/users/chloe/home.nix +++ b/users/chloe/home.nix @@ -13,6 +13,7 @@ in ffmpeg ripgrep uv + nh ]; # packages to install for desktop environments (non-server) desktop = [ @@ -36,9 +37,31 @@ in btop.enable = true; fd.enable = true; hyfetch.enable = true; - zsh.enable = true; # sort-lines:end + # zsh is the shell i use + zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + history.size = 10000; + + shellAliases = { + switch = "nh darwin switch ~/config"; + }; + profileExtra = '' + function python() { + dirname=$(dirname $1 2>/dev/null) + if [ -z "$dirname" ]; then + dirname=$(pwd) + fi + uv run --project "$dirname" "$@" + } + ''; + }; + # use a git-specific email git.userEmail = "git@paperclover.net"; diff --git a/users/chloe/vim.nix b/users/chloe/vim.nix index f7db33f..eb49c66 100644 --- a/users/chloe/vim.nix +++ b/users/chloe/vim.nix @@ -1,5 +1,6 @@ { ... }: { + vim.languages.astro.enable = true; vim.theme.extraConfig = '' if vim.g.neovide then vim.g.neovide_cursor_trail_size = 0.3