mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-23 13:50:44 +00:00
Compare commits
1 commit
734ced398e
...
efc0ba8f97
Author | SHA1 | Date | |
---|---|---|---|
|
efc0ba8f97 |
3 changed files with 43 additions and 47 deletions
23
flake.lock
23
flake.lock
|
@ -69,11 +69,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1723419050,
|
"lastModified": 1722191188,
|
||||||
"narHash": "sha256-Eb8jBUgHwpte+bGsqeXNbKMBfZaDB7RiPQwyb1vzJK8=",
|
"narHash": "sha256-YF//iMALbrd2Ni9aju7w8NniH16Qz6RFTRD6md5UkDc=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "e625f5965567f16102bc52897c7600dcde53c6c3",
|
"rev": "c7b289f3f5a31b6e744be37d83fc231816621231",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -955,22 +955,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"plugin-new-file-template-nvim": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1721518222,
|
|
||||||
"narHash": "sha256-g0IjJrHRXw7U9goVLzVYUyHBSsDZGHMpi3YZPhg64zA=",
|
|
||||||
"owner": "otavioschwanck",
|
|
||||||
"repo": "new-file-template.nvim",
|
|
||||||
"rev": "6ac66669dbf2dc5cdee184a4fe76d22465ca67e8",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "otavioschwanck",
|
|
||||||
"repo": "new-file-template.nvim",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugin-noice-nvim": {
|
"plugin-noice-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1895,7 +1879,6 @@
|
||||||
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
||||||
"plugin-neocord": "plugin-neocord",
|
"plugin-neocord": "plugin-neocord",
|
||||||
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
||||||
"plugin-new-file-template-nvim": "plugin-new-file-template-nvim",
|
|
||||||
"plugin-noice-nvim": "plugin-noice-nvim",
|
"plugin-noice-nvim": "plugin-noice-nvim",
|
||||||
"plugin-none-ls": "plugin-none-ls",
|
"plugin-none-ls": "plugin-none-ls",
|
||||||
"plugin-nui-nvim": "plugin-nui-nvim",
|
"plugin-nui-nvim": "plugin-nui-nvim",
|
||||||
|
|
|
@ -9,63 +9,75 @@ inputs: {
|
||||||
inherit (pkgs) vimPlugins;
|
inherit (pkgs) vimPlugins;
|
||||||
inherit (lib.strings) isString toString;
|
inherit (lib.strings) isString toString;
|
||||||
inherit (lib.lists) filter map concatLists;
|
inherit (lib.lists) filter map concatLists;
|
||||||
|
inherit (lib.attrsets) recursiveUpdate;
|
||||||
|
|
||||||
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
||||||
# check can be disabled while calling this file is called
|
# check can be disabled while calling this file is called
|
||||||
# to avoid checking in all modules
|
# to avoid checking in all modules
|
||||||
nvimModules = import ./modules.nix {inherit pkgs check lib;};
|
nvimModules = import ./modules.nix {
|
||||||
|
inherit pkgs check lib;
|
||||||
|
};
|
||||||
|
|
||||||
# evaluate the extended library with the modules
|
# evaluate the extended library with the modules
|
||||||
# optionally with any additional modules passed by the user
|
# optionally with any additional modules passed by the user
|
||||||
module = lib.evalModules {
|
module = lib.evalModules {
|
||||||
specialArgs = extraSpecialArgs // {modulesPath = toString ./.;};
|
specialArgs = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs;
|
||||||
modules = concatLists [[configuration] nvimModules extraModules];
|
modules = concatLists [[configuration] nvimModules extraModules];
|
||||||
};
|
};
|
||||||
|
|
||||||
# alias to the internal configuration
|
# alias to the internal configuration
|
||||||
vimOptions = module.config.vim;
|
vimOptions = module.config.vim;
|
||||||
|
|
||||||
noBuildPlug = {pname, ...} @ attrs: let
|
|
||||||
src = inputs."plugin-${attrs.pname}";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
version = src.shortRev or src.shortDirtyRev or "dirty";
|
|
||||||
outPath = src;
|
|
||||||
passthru.vimPlugin = false;
|
|
||||||
}
|
|
||||||
// attrs;
|
|
||||||
|
|
||||||
# build a vim plugin with the given name and arguments
|
# build a vim plugin with the given name and arguments
|
||||||
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||||
# instead
|
# instead
|
||||||
buildPlug = attrs: let
|
buildPlug = attrs: let
|
||||||
src = inputs."plugin-${attrs.pname}";
|
src = inputs."plugin-${attrs.pname}";
|
||||||
in
|
in
|
||||||
pkgs.vimUtils.buildVimPlugin (
|
pkgs.stdenvNoCC.mkDerivation ({
|
||||||
{
|
|
||||||
version = src.shortRev or src.shortDirtyRev or "dirty";
|
version = src.shortRev or src.shortDirtyRev or "dirty";
|
||||||
|
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs.vimUtils; [
|
||||||
|
vimCommandCheckHook
|
||||||
|
vimGenDocHook
|
||||||
|
neovimRequireCheckHook
|
||||||
|
];
|
||||||
|
passthru.vimPlugin = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r . $out
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
// attrs
|
// attrs);
|
||||||
);
|
|
||||||
|
|
||||||
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
||||||
|
|
||||||
pluginBuilders = {
|
pluginBuilders = {
|
||||||
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
|
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
|
||||||
flutter-tools-patched = buildPlug {
|
flutter-tools-patched =
|
||||||
|
buildPlug
|
||||||
|
{
|
||||||
pname = "flutter-tools";
|
pname = "flutter-tools";
|
||||||
patches = [../patches/flutter-tools.patch];
|
patches = [../patches/flutter-tools.patch];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
buildConfigPlugins = plugins:
|
buildConfigPlugins = plugins:
|
||||||
map (
|
map
|
||||||
|
(
|
||||||
plug:
|
plug:
|
||||||
if (isString plug)
|
if (isString plug)
|
||||||
then pluginBuilders.${plug} or (noBuildPlug {pname = plug;})
|
then pluginBuilders.${plug} or (buildPlug {pname = plug;})
|
||||||
else plug
|
else plug
|
||||||
) (filter (f: f != null) plugins);
|
)
|
||||||
|
(filter (f: f != null) plugins);
|
||||||
|
|
||||||
# built (or "normalized") plugins that are modified
|
# built (or "normalized") plugins that are modified
|
||||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||||
|
@ -75,7 +87,7 @@ inputs: {
|
||||||
}) (buildConfigPlugins vimOptions.optPlugins);
|
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||||
|
|
||||||
# additional Lua and Python3 packages, mapped to their respective functions
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
# to conform to the format mnw expects. end user should
|
# to conform to the format makeNeovimConfig expects. end user should
|
||||||
# only ever need to pass a list of packages, which are modified
|
# only ever need to pass a list of packages, which are modified
|
||||||
# here
|
# here
|
||||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||||
|
@ -85,7 +97,7 @@ inputs: {
|
||||||
# generate a wrapped Neovim package.
|
# generate a wrapped Neovim package.
|
||||||
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
||||||
neovim = vimOptions.package;
|
neovim = vimOptions.package;
|
||||||
plugins = builtStartPlugins ++ builtOptPlugins;
|
plugins = concatLists [builtStartPlugins builtOptPlugins];
|
||||||
appName = "nvf";
|
appName = "nvf";
|
||||||
extraBinPath = vimOptions.extraPackages;
|
extraBinPath = vimOptions.extraPackages;
|
||||||
initLua = vimOptions.builtLuaConfigRC;
|
initLua = vimOptions.builtLuaConfigRC;
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map mapAttrs filter;
|
inherit (builtins) map mapAttrs filter;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) mapAttrsToList filterAttrs getAttrs attrValues attrNames;
|
inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames;
|
||||||
inherit (lib.strings) concatLines concatMapStringsSep;
|
inherit (lib.strings) concatLines concatMapStringsSep;
|
||||||
|
inherit (lib.misc) mapAttrsFlatten;
|
||||||
inherit (lib.trivial) showWarnings;
|
inherit (lib.trivial) showWarnings;
|
||||||
inherit (lib.types) str nullOr;
|
inherit (lib.types) str nullOr;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
@ -82,7 +83,7 @@ in {
|
||||||
config = let
|
config = let
|
||||||
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
|
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
|
||||||
globalsScript =
|
globalsScript =
|
||||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}")
|
mapAttrsFlatten (name: value: "vim.g.${name} = ${toLuaObject value}")
|
||||||
(filterNonNull cfg.globals);
|
(filterNonNull cfg.globals);
|
||||||
|
|
||||||
extraPluginConfigs = resolveDag {
|
extraPluginConfigs = resolveDag {
|
||||||
|
|
Loading…
Reference in a new issue