From 7e87ede672edd55e0fccbad2460e6a91cc08d9c3 Mon Sep 17 00:00:00 2001 From: iofq Date: Sat, 15 Mar 2025 00:47:23 -0500 Subject: [PATCH] build(flake): enable for all systems --- .envrc | 1 + flake.nix | 14 +++++++------- nix/mkNeovim.nix | 3 ++- nix/neovim-overlay.nix | 12 ++++++++++++ nvim/lua/plugins/misc.lua | 33 +++++++++++++++++---------------- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/.envrc b/.envrc index a1d3540..6ea6480 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ +watch_file nix/* use flake . -Lv diff --git a/flake.nix b/flake.nix index eaec499..ee4dbe2 100644 --- a/flake.nix +++ b/flake.nix @@ -19,15 +19,12 @@ gen-luarc, ... }: let - supportedSystems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; + systems = builtins.attrNames nixpkgs.legacyPackages; + + # This is where the Neovim derivation is built. neovim-overlay = import ./nix/neovim-overlay.nix {inherit inputs;}; in - flake-utils.lib.eachSystem supportedSystems (system: let + flake-utils.lib.eachSystem systems (system: let pkgs = import nixpkgs { inherit system; overlays = [ @@ -43,9 +40,12 @@ nil stylua luajitPackages.luacheck + nvim-dev ]; shellHook = '' ln -fs ${pkgs.nvim-luarc-json} .luarc.json + # allow quick iteration of lua configs + ln -Tfns $PWD/nvim ~/.config/nvim-dev ''; }; in { diff --git a/nix/mkNeovim.nix b/nix/mkNeovim.nix index 95975ff..08ffcaf 100644 --- a/nix/mkNeovim.nix +++ b/nix/mkNeovim.nix @@ -34,6 +34,7 @@ with lib; # if the appName is something different than "nvim" viAlias ? appName == "nvim", # Add a "vi" binary to the build output as an alias? vimAlias ? appName == "nvim", # Add a "vim" binary to the build output as an alias? + wrapRc ? true, }: let # This is the structure of a plugin definition. # Each plugin in the `plugins` argument list can also be defined as this attrset @@ -176,7 +177,7 @@ with lib; + extraMakeWrapperLuaCArgs + " " + extraMakeWrapperLuaArgs; - wrapRc = true; + wrapRc = wrapRc; }); isCustomAppName = appName != null && appName != "nvim"; diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index cd6b085..bfe71a7 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -21,6 +21,7 @@ with final.pkgs.lib; let eyeliner-nvim friendly-snippets gitsigns-nvim + hunk-nvim lazy-nvim luasnip mini-nvim @@ -83,6 +84,17 @@ in { ]; }; + # This is meant to be used within a devshell. + # Instead of loading the lua Neovim configuration from + # the Nix store, it is loaded from $XDG_CONFIG_HOME/nvim-dev + nvim-dev = mkNeovim { + plugins = all-plugins; + extraPackages = basePackages ++ extraPackages; + appName = "nvim-dev"; + wrapRc = false; + }; + + # This can be symlinked in the devShell's shellHook nvim-luarc-json = final.mk-luarc-json { plugins = all-plugins; }; diff --git a/nvim/lua/plugins/misc.lua b/nvim/lua/plugins/misc.lua index e1fa9f3..c1b786a 100644 --- a/nvim/lua/plugins/misc.lua +++ b/nvim/lua/plugins/misc.lua @@ -38,22 +38,22 @@ return { { 'nb', vim.cmd.DiffviewOpen, noremap = true, desc = 'diffview open' } }, }, - { - 'NeogitOrg/neogit', - opts = { - disable_builtin_notifications = true, - integrations = { - diffview = true, - }, - }, - keys = { - { - 'ng', - function() require('neogit').open() end, - { noremap = true, silent = true, desc = 'Neogit' }, - }, - }, - }, + -- { + -- 'NeogitOrg/neogit', + -- opts = { + -- disable_builtin_notifications = true, + -- integrations = { + -- diffview = true, + -- }, + -- }, + -- keys = { + -- { + -- 'ng', + -- function() require('neogit').open() end, + -- { noremap = true, silent = true, desc = 'Neogit' }, + -- }, + -- }, + -- }, { 'EdenEast/nightfox.nvim', lazy = false, @@ -123,6 +123,7 @@ return { end, }, }, + { '/julienvincent/hunk.nvim', event = 'VeryLazy', opts = {} }, { 'gbprod/yanky.nvim', opts = {