mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 18:54:30 +02:00
Use init.lua instead of init.vim (#64)
* Use init.lua instead of init.vim * fix standalone generation Co-authored-by: cyrusng <cyrus.ng@protonmail.com> Co-authored-by: Pedro Alves <pta2002@pta2002.com>
This commit is contained in:
parent
1fa86d1699
commit
3849a1de9a
4 changed files with 24 additions and 18 deletions
|
@ -79,7 +79,7 @@ in
|
||||||
|
|
||||||
initContent = mkOption {
|
initContent = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The content of the init.vim file";
|
description = "The content of the init.lua file";
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
visible = false;
|
visible = false;
|
||||||
};
|
};
|
||||||
|
@ -89,15 +89,16 @@ in
|
||||||
let
|
let
|
||||||
customRC =
|
customRC =
|
||||||
(optionalString (config.extraConfigLuaPre != "") ''
|
(optionalString (config.extraConfigLuaPre != "") ''
|
||||||
lua <<EOF
|
|
||||||
${config.extraConfigLuaPre}
|
${config.extraConfigLuaPre}
|
||||||
EOF
|
|
||||||
'') +
|
'') +
|
||||||
config.extraConfigVim + (optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
(optionalString (config.extraConfigVim != "") ''
|
||||||
lua <<EOF
|
vim.cmd([[
|
||||||
|
${config.extraConfigVim}
|
||||||
|
]])
|
||||||
|
'') +
|
||||||
|
(optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||||
${config.extraConfigLua}
|
${config.extraConfigLua}
|
||||||
${config.extraConfigLuaPost}
|
${config.extraConfigLuaPost}
|
||||||
EOF
|
|
||||||
'');
|
'');
|
||||||
|
|
||||||
defaultPlugin = {
|
defaultPlugin = {
|
||||||
|
@ -109,7 +110,7 @@ in
|
||||||
normalizedPlugins = map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) config.extraPlugins;
|
normalizedPlugins = map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) config.extraPlugins;
|
||||||
|
|
||||||
neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
|
neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
|
||||||
inherit customRC;
|
# inherit customRC;
|
||||||
plugins = normalizedPlugins;
|
plugins = normalizedPlugins;
|
||||||
}
|
}
|
||||||
# Necessary to make sure the runtime path is set properly in NixOS 22.05,
|
# Necessary to make sure the runtime path is set properly in NixOS 22.05,
|
||||||
|
@ -120,12 +121,17 @@ in
|
||||||
{ nixvim = { start = map (x: x.plugin) normalizedPlugins; opt = [ ]; }; };
|
{ nixvim = { start = map (x: x.plugin) normalizedPlugins; opt = [ ]; }; };
|
||||||
});
|
});
|
||||||
|
|
||||||
extraWrapperArgs = optionalString (config.extraPackages != [ ])
|
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||||
''--prefix PATH : "${makeBinPath config.extraPackages}"'';
|
(optional (config.extraPackages != [ ])
|
||||||
|
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
|
||||||
|
++
|
||||||
|
(optional (config.wrapRc)
|
||||||
|
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
|
||||||
|
);
|
||||||
|
|
||||||
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig // {
|
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig // {
|
||||||
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
|
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
|
||||||
inherit (config) wrapRc;
|
wrapRc = false;
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
12
tests/flake.lock
generated
12
tests/flake.lock
generated
|
@ -97,12 +97,12 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"narHash": "sha256-FTGR/AeBEZQeWqSQqbnR+3oW4NJvhwshJu8/mHDWwQ8=",
|
"narHash": "sha256-p/xU46Ew3l56jrG0A+yeRLrOCxRMfAu3JBVvMP0bFUQ=",
|
||||||
"path": "/nix/store/rhjvdj0kd7drmgnaj06q3kazi496zb6f-source",
|
"path": "/nix/store/h0ngn8s4pvbwifcc7b0waxmhrgkf5d62-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/rhjvdj0kd7drmgnaj06q3kazi496zb6f-source",
|
"path": "/nix/store/h0ngn8s4pvbwifcc7b0waxmhrgkf5d62-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -116,12 +116,12 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"narHash": "sha256-FTGR/AeBEZQeWqSQqbnR+3oW4NJvhwshJu8/mHDWwQ8=",
|
"narHash": "sha256-p/xU46Ew3l56jrG0A+yeRLrOCxRMfAu3JBVvMP0bFUQ=",
|
||||||
"path": "/nix/store/rhjvdj0kd7drmgnaj06q3kazi496zb6f-source",
|
"path": "/nix/store/h0ngn8s4pvbwifcc7b0waxmhrgkf5d62-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/rhjvdj0kd7drmgnaj06q3kazi496zb6f-source",
|
"path": "/nix/store/h0ngn8s4pvbwifcc7b0waxmhrgkf5d62-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,7 +27,7 @@ in
|
||||||
(mkMerge [
|
(mkMerge [
|
||||||
{ home.packages = [ cfg.finalPackage ]; }
|
{ home.packages = [ cfg.finalPackage ]; }
|
||||||
(mkIf (!cfg.wrapRc) {
|
(mkIf (!cfg.wrapRc) {
|
||||||
xdg.configFile."nvim/init.vim".text = cfg.initContent;
|
xdg.configFile."nvim/init.lua".text = cfg.initContent;
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ in
|
||||||
(mkMerge [
|
(mkMerge [
|
||||||
{ environment.systemPackages = [ cfg.finalPackage ]; }
|
{ environment.systemPackages = [ cfg.finalPackage ]; }
|
||||||
(mkIf (!cfg.wrapRc) {
|
(mkIf (!cfg.wrapRc) {
|
||||||
environment.etc."nvim/sysinit.vim".text = cfg.initContent;
|
environment.etc."nvim/sysinit.lua".text = cfg.initContent;
|
||||||
environment.variables."VIM" = "/etc/nvim";
|
environment.variables."VIM" = "/etc/nvim";
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue