mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-28 05:01:03 +01:00
modules/output: add build.initSource option
Allows access to the init "source" file even when `performance.byteCompileLua` is enabled.
This commit is contained in:
parent
692e39311e
commit
2ab8751b8b
1 changed files with 28 additions and 7 deletions
|
|
@ -79,7 +79,25 @@ in
|
||||||
|
|
||||||
initFile = mkOption {
|
initFile = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
description = "The generated `init.lua` file.";
|
description = ''
|
||||||
|
The generated `init.lua` file.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If `performance.byteCompileLua` is enabled, this file may not contain human-readable lua source code.
|
||||||
|
> Consider using `build.initSource` instead.
|
||||||
|
'';
|
||||||
|
readOnly = true;
|
||||||
|
visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
initSource = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = ''
|
||||||
|
The generated `init.lua` source file.
|
||||||
|
|
||||||
|
This is usually identical to `build.initFile`, however if `performance.byteCompileLua` is enabled,
|
||||||
|
this option will refer to the un-compiled lua source file.
|
||||||
|
'';
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
visible = false;
|
visible = false;
|
||||||
};
|
};
|
||||||
|
|
@ -249,17 +267,17 @@ in
|
||||||
config.content
|
config.content
|
||||||
];
|
];
|
||||||
|
|
||||||
textInit = builders.writeLua "init.lua" customRC;
|
initSource = builders.writeLua "init.lua" customRC;
|
||||||
byteCompiledInit = builders.writeByteCompiledLua "init.lua" customRC;
|
initByteCompiled = builders.writeByteCompiledLua "init.lua" customRC;
|
||||||
initFile =
|
initFile =
|
||||||
if
|
if
|
||||||
config.type == "lua"
|
config.type == "lua"
|
||||||
&& config.performance.byteCompileLua.enable
|
&& config.performance.byteCompileLua.enable
|
||||||
&& config.performance.byteCompileLua.initLua
|
&& config.performance.byteCompileLua.initLua
|
||||||
then
|
then
|
||||||
byteCompiledInit
|
initByteCompiled
|
||||||
else
|
else
|
||||||
textInit;
|
initSource;
|
||||||
|
|
||||||
extraWrapperArgs = builtins.concatStringsSep " " (
|
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||||
(optional (
|
(optional (
|
||||||
|
|
@ -300,13 +318,16 @@ in
|
||||||
{
|
{
|
||||||
build = {
|
build = {
|
||||||
package = wrappedNeovim;
|
package = wrappedNeovim;
|
||||||
inherit initFile;
|
inherit initFile initSource;
|
||||||
|
|
||||||
printInitPackage = pkgs.writeShellApplication {
|
printInitPackage = pkgs.writeShellApplication {
|
||||||
name = "nixvim-print-init";
|
name = "nixvim-print-init";
|
||||||
runtimeInputs = [ pkgs.bat ];
|
runtimeInputs = [ pkgs.bat ];
|
||||||
|
runtimeEnv = {
|
||||||
|
init = config.build.initSource;
|
||||||
|
};
|
||||||
text = ''
|
text = ''
|
||||||
bat --language=lua "${textInit}"
|
bat --language=lua "$init"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue