flake: refactor package
- loads init.lua directly, before it loads a lua file -> vimscript (`customRC`) -> init.lua - split the wrapper into its own package, makes `src` and `runtimeDeps` overridable - inherit args into `makeNeovimConfig`, makes e.g. `vimAlias` in `wrapNeovimUnstable` work
This commit is contained in:
parent
dc5c35f23d
commit
3fbc02368d
2 changed files with 34 additions and 25 deletions
17
flake.nix
17
flake.nix
|
@ -22,9 +22,7 @@
|
|||
inherit (inputs.nixpkgs) lib;
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||
in {
|
||||
### nix {run,shell,build}
|
||||
packages.default = let
|
||||
|
||||
runtimeDeps = with pkgs; [
|
||||
# mason / tree-sitter
|
||||
gcc
|
||||
|
@ -35,20 +33,13 @@
|
|||
ripgrep
|
||||
fd
|
||||
];
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
fileset = lib.fileset.fileFilter (file: file.hasExt "lua") ./.;
|
||||
root = ./.;
|
||||
};
|
||||
in
|
||||
pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped
|
||||
(pkgs.neovimUtils.makeNeovimConfig {
|
||||
customRC = ''
|
||||
set runtimepath^=${src}
|
||||
source ${src}/init.lua
|
||||
'';
|
||||
}
|
||||
// {wrapperArgs = ["--prefix" "PATH" ":" "${lib.makeBinPath runtimeDeps}"];});
|
||||
in {
|
||||
### nix {run,shell,build}
|
||||
packages.default = pkgs.callPackage ./package.nix {inherit runtimeDeps src;};
|
||||
|
||||
### nix fmt
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
|
|
18
package.nix
Normal file
18
package.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
lib,
|
||||
wrapNeovimUnstable,
|
||||
neovim-unwrapped,
|
||||
neovimUtils,
|
||||
runtimeDeps ? null,
|
||||
src ? null,
|
||||
...
|
||||
} @ args:
|
||||
wrapNeovimUnstable neovim-unwrapped (neovimUtils.makeNeovimConfig args
|
||||
// {
|
||||
# FIXME: append instead of override the entire wrapperArgs
|
||||
wrapperArgs = ["--prefix" "PATH" ":" "${lib.makeBinPath runtimeDeps}"];
|
||||
luaRcContent = ''
|
||||
vim.cmd [[set runtimepath^=${src}]]
|
||||
${builtins.readFile "${src}/init.lua"}
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue