add flake compat
This commit is contained in:
parent
005ddc0b9e
commit
437e0e05cf
4 changed files with 86 additions and 78 deletions
79
default.nix
79
default.nix
|
@ -1,76 +1,3 @@
|
|||
{ enableDevIcons ? false
|
||||
, enableBarBar ? false
|
||||
, enableTabby ? false
|
||||
, enableOrgMode ? false
|
||||
, viAlias ? false
|
||||
, vimAlias ? false
|
||||
, grammarFileTypes ? [ "nix" ]
|
||||
, theme ? { }
|
||||
, plugins ? { }
|
||||
, wrapNeovim
|
||||
, neovim-unwrapped
|
||||
, tree-sitter
|
||||
, neovimPlugins
|
||||
, lib
|
||||
, nix2lua
|
||||
, substituteAll
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (builtins) catAttrs isFunction readFile;
|
||||
myLib = import ./lib.nix { inherit lib; } // {
|
||||
inherit substituteAll;
|
||||
inherit (nix2lua.lib) toLua;
|
||||
};
|
||||
|
||||
pluginParams = neovimPlugins // {
|
||||
inherit plugins;
|
||||
inherit tree-sitter grammarFileTypes;
|
||||
inherit enableDevIcons enableTabby enableOrgMode;
|
||||
themeCfg = theme;
|
||||
lib = myLib;
|
||||
};
|
||||
|
||||
callPlugin = op:
|
||||
if isFunction op then op pluginParams else import op pluginParams;
|
||||
callPlugins = list: map callPlugin list;
|
||||
|
||||
pluginsSettings = callPlugins [
|
||||
./plugins/config
|
||||
./plugins/syntax
|
||||
./plugins/git
|
||||
./plugins/explorer
|
||||
./plugins/theme
|
||||
./plugins/lsp
|
||||
./plugins/formatter
|
||||
./plugins/ux
|
||||
];
|
||||
|
||||
basePlugins = [ neovimPlugins.plenary-nvim ];
|
||||
customPlugins = catAttrs "plugins" pluginsSettings;
|
||||
allPlugins = basePlugins ++ customPlugins;
|
||||
|
||||
basicConfigs = map readFile [ ./config/basic.lua ];
|
||||
pluginConfigs = catAttrs "luaConfig" pluginsSettings;
|
||||
allConfigs = basicConfigs ++ pluginConfigs;
|
||||
in
|
||||
(wrapNeovim neovim-unwrapped {
|
||||
inherit viAlias;
|
||||
inherit vimAlias;
|
||||
|
||||
withPython3 = false;
|
||||
withNodeJs = false;
|
||||
withRuby = false;
|
||||
|
||||
configure = {
|
||||
customRC = myLib.mkLuaRc allConfigs;
|
||||
|
||||
packages.myVimPackages = { start = allPlugins; };
|
||||
};
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
passthru = oldAttrs.passthru // {
|
||||
nix2lua = nix2lua.lib;
|
||||
inherit plugins;
|
||||
};
|
||||
})
|
||||
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
|
||||
src = builtins.fetchGit ./.;
|
||||
}).defaultNix
|
||||
|
|
|
@ -212,11 +212,13 @@
|
|||
inherit neovimPlugins;
|
||||
inherit nix2lua;
|
||||
};
|
||||
|
||||
mkNeovim = pkgs: pkgs.callPackage ./neovim.nix (mkNvimPlugins pkgs);
|
||||
in
|
||||
{
|
||||
overlays = {
|
||||
default = final: prev: {
|
||||
myneovim = prev.callPackage self (mkNvimPlugins prev);
|
||||
myneovim = mkNeovim prev;
|
||||
};
|
||||
};
|
||||
} //
|
||||
|
@ -225,7 +227,7 @@
|
|||
inherit (builtins) mapAttrs;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
minimalNeovim = pkgs.callPackage self (mkNvimPlugins pkgs);
|
||||
minimalNeovim = mkNeovim pkgs;
|
||||
|
||||
recommendedNeovim = (minimalNeovim.override {
|
||||
enableDevIcons = true;
|
||||
|
|
76
neovim.nix
Normal file
76
neovim.nix
Normal file
|
@ -0,0 +1,76 @@
|
|||
{ enableDevIcons ? false
|
||||
, enableBarBar ? false
|
||||
, enableTabby ? false
|
||||
, enableOrgMode ? false
|
||||
, viAlias ? false
|
||||
, vimAlias ? false
|
||||
, grammarFileTypes ? [ "nix" ]
|
||||
, theme ? { }
|
||||
, plugins ? { }
|
||||
, wrapNeovim
|
||||
, neovim-unwrapped
|
||||
, tree-sitter
|
||||
, neovimPlugins
|
||||
, lib
|
||||
, nix2lua
|
||||
, substituteAll
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (builtins) catAttrs isFunction readFile;
|
||||
myLib = import ./lib.nix { inherit lib; } // {
|
||||
inherit substituteAll;
|
||||
inherit (nix2lua.lib) toLua;
|
||||
};
|
||||
|
||||
pluginParams = neovimPlugins // {
|
||||
inherit plugins;
|
||||
inherit tree-sitter grammarFileTypes;
|
||||
inherit enableDevIcons enableTabby enableOrgMode;
|
||||
themeCfg = theme;
|
||||
lib = myLib;
|
||||
};
|
||||
|
||||
callPlugin = op:
|
||||
if isFunction op then op pluginParams else import op pluginParams;
|
||||
callPlugins = list: map callPlugin list;
|
||||
|
||||
pluginsSettings = callPlugins [
|
||||
./plugins/config
|
||||
./plugins/syntax
|
||||
./plugins/git
|
||||
./plugins/explorer
|
||||
./plugins/theme
|
||||
./plugins/lsp
|
||||
./plugins/formatter
|
||||
./plugins/ux
|
||||
];
|
||||
|
||||
basePlugins = [ neovimPlugins.plenary-nvim ];
|
||||
customPlugins = catAttrs "plugins" pluginsSettings;
|
||||
allPlugins = basePlugins ++ customPlugins;
|
||||
|
||||
basicConfigs = map readFile [ ./config/basic.lua ];
|
||||
pluginConfigs = catAttrs "luaConfig" pluginsSettings;
|
||||
allConfigs = basicConfigs ++ pluginConfigs;
|
||||
in
|
||||
(wrapNeovim neovim-unwrapped {
|
||||
inherit viAlias;
|
||||
inherit vimAlias;
|
||||
|
||||
withPython3 = false;
|
||||
withNodeJs = false;
|
||||
withRuby = false;
|
||||
|
||||
configure = {
|
||||
customRC = myLib.mkLuaRc allConfigs;
|
||||
|
||||
packages.myVimPackages = { start = allPlugins; };
|
||||
};
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
passthru = oldAttrs.passthru // {
|
||||
nix2lua = nix2lua.lib;
|
||||
inherit plugins;
|
||||
};
|
||||
})
|
3
shell.nix
Normal file
3
shell.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
|
||||
src = builtins.fetchGit ./.;
|
||||
}).shellNix
|
Reference in a new issue