summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock16
-rw-r--r--flake.nix16
-rw-r--r--lua/getchoo/init.lua5
-rw-r--r--neovim.nix99
-rw-r--r--wrapper.nix66
5 files changed, 147 insertions, 55 deletions
diff --git a/flake.lock b/flake.lock
index 25b00ff..de0d98b 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,20 @@
{
"nodes": {
+ "nix-filter": {
+ "locked": {
+ "lastModified": 1730207686,
+ "narHash": "sha256-SCHiL+1f7q9TAnxpasriP6fMarWE5H43t25F5/9e28I=",
+ "owner": "numtide",
+ "repo": "nix-filter",
+ "rev": "776e68c1d014c3adde193a18db9d738458cd2ba4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "nix-filter",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1729850857,
@@ -18,6 +33,7 @@
},
"root": {
"inputs": {
+ "nix-filter": "nix-filter",
"nixpkgs": "nixpkgs"
}
}
diff --git a/flake.nix b/flake.nix
index aa09357..20a6042 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,12 +3,14 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ nix-filter.url = "github:numtide/nix-filter";
};
outputs =
{
self,
nixpkgs,
+ nix-filter,
}:
let
inherit (nixpkgs) lib;
@@ -39,7 +41,7 @@
month
day
];
- version = "0-unstable-${date}";
+ version = "0-unstable-" + date;
in
{
checks = forAllSystems (
@@ -95,13 +97,21 @@
pkgs = nixpkgsFor.${system};
ourPackages = lib.makeScope pkgs.newScope (final: {
- getchvim = final.callPackage ./neovim.nix { };
+ mkNeovimDerivation = final.callPackage ./wrapper.nix { };
+ getchvim = final.callPackage ./neovim.nix { inherit version; };
getchoo-neovim-config = pkgs.vimUtils.buildVimPlugin {
pname = "getchoo-neovim-config";
inherit version;
- src = self;
+ src = nix-filter.lib.filter {
+ root = self;
+ include = [
+ ./lua
+ ./ftdetect
+ ./ftplugin
+ ];
+ };
};
});
in
diff --git a/lua/getchoo/init.lua b/lua/getchoo/init.lua
index 021333c..da2e986 100644
--- a/lua/getchoo/init.lua
+++ b/lua/getchoo/init.lua
@@ -15,6 +15,11 @@ opt.wrap = true
opt.mouse = "a"
opt.showmode = false -- status line does this
+-- don't use remote plugins
+g.loaded_python3_provider = 0
+g.loaded_ruby_provider = 0
+g.loaded_node_provider = 0
+
require("lz.n").load("getchoo/plugins")
vim.cmd.colorscheme("catppuccin")
diff --git a/neovim.nix b/neovim.nix
index 74dc667..f909fcf 100644
--- a/neovim.nix
+++ b/neovim.nix
@@ -1,9 +1,10 @@
{
- lib,
+ mkNeovimDerivation,
+ getchoo-neovim-config,
+ version,
+
actionlint,
glow,
- neovim-unwrapped,
- neovimUtils,
nil,
nixfmt-rfc-style,
nodePackages,
@@ -12,17 +13,49 @@
statix,
typos-lsp,
vimPlugins,
- wrapNeovimUnstable,
-
- getchoo-neovim-config,
+ writeTextDir,
}:
-let
- plugins = with vimPlugins; [
- getchoo-neovim-config
+mkNeovimDerivation {
+ pname = "getchvim";
+ inherit version;
+
+ luaRc = writeTextDir "init.lua" "require('getchoo')" + "/init.lua";
+
+ runtimePrograms = [
+ # External programs
+ glow
+
+ # LSP
+ ## General
+ typos-lsp
+
+ ## Language-specific
+ nodePackages.bash-language-server
+ shellcheck
+ shfmt
+ nil
+ nixfmt-rfc-style
+
+ # Linters
+ nodePackages.alex
+ actionlint
+ statix
+ ];
+
+ luaPluginPackages =
+ luaPackages: with luaPackages; [
+ lz-n
- # lazy loader
- lz-n
+ # Coding
+ nvim-cmp
+
+ # LSP
+ fidget-nvim
+ ];
+
+ vimPluginPackages = with vimPlugins; [
+ getchoo-neovim-config
# Editing
flash-nvim
@@ -37,59 +70,21 @@ let
lualine-nvim
# Coding
- nvim-cmp
- luasnip
cmp-async-path
cmp-buffer
cmp-nvim-lsp
crates-nvim
+ ## TODO: Use luarocks plugin when it's not broken
gitsigns-nvim
nvim-lint
+ ## TODO: Ditto
telescope-nvim # dependent on >
plenary-nvim
# LSP
- fidget-nvim
lsp-format-nvim
nvim-lspconfig
trouble-nvim
];
-
- extraPackages = [
- # External programs
- glow
-
- # LSP
- ## General
- typos-lsp
-
- ## Language-specific
- nodePackages.bash-language-server
- shellcheck
- shfmt
- nil
- nixfmt-rfc-style
-
- # Linters
- nodePackages.alex
- actionlint
- statix
- ];
-
- baseConfig = neovimUtils.makeNeovimConfig {
- withRuby = false;
- inherit plugins;
- };
-
- config = baseConfig // {
- luaRcContent = "require('getchoo')";
- wrapperArgs = baseConfig.wrapperArgs ++ [
- "--suffix"
- "PATH"
- ":"
- "${lib.makeBinPath extraPackages}"
- ];
- };
-in
-wrapNeovimUnstable neovim-unwrapped config
+}
diff --git a/wrapper.nix b/wrapper.nix
new file mode 100644
index 0000000..1127e61
--- /dev/null
+++ b/wrapper.nix
@@ -0,0 +1,66 @@
+{
+ lib,
+ emptyFile,
+ lua,
+ makeBinaryWrapper,
+ neovim-unwrapped,
+ neovimUtils,
+ runCommand,
+ writeText,
+}:
+{
+ pname ? lib.removeSuffix "-unwrapped" neovim-unwrapped.pname,
+ version ? neovim-unwrapped.version,
+ name ? "${pname}-${version}",
+ makeWrapperArgs ? [ ],
+ luaPluginPackages ? _: [ ],
+ vimPluginPackages ? [ ],
+ runtimePrograms ? [ ],
+ luaRc ? emptyFile,
+ ...
+}:
+
+let
+ luaEnv = lua.withPackages luaPluginPackages;
+
+ normalizedPlugins = neovimUtils.normalizePlugins vimPluginPackages;
+ neovimPackage = neovimUtils.normalizedPluginsToVimPackage normalizedPlugins;
+ packDir = neovimUtils.packDir { inherit neovimPackage; };
+
+ vendorRc = writeText "vendor.vim" ''
+ lua package.path = "${luaEnv.luaPath}"; package.cpath = "${luaEnv.luaCpath}"
+ set packpath^=${packDir} | set runtimepath^=${packDir}
+ luafile ${luaRc}
+ '';
+
+ flags = [
+ "-u"
+ (toString vendorRc)
+ ];
+in
+runCommand name
+ {
+ __structuredAttrs = true;
+
+ nativeBuildInputs = [ makeBinaryWrapper ];
+
+ makeWrapperArgs = makeWrapperArgs ++ [
+ "--add-flags"
+ (lib.escapeShellArgs flags)
+ "--suffix"
+ "PATH"
+ ":"
+ (lib.makeBinPath runtimePrograms)
+ ];
+
+ passthru = {
+ inherit luaEnv;
+ };
+
+ meta = {
+ inherit (neovim-unwrapped.meta) description mainProgram;
+ };
+ }
+ ''
+ makeWrapper ${lib.getExe neovim-unwrapped} $out/bin/nvim "''${makeWrapperArgs[@]}"
+ ''