mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
lib/builders: pass text as file
This fixes potential "argument list too long" errors from bash when writing large files.
This commit is contained in:
parent
64f0d3c86a
commit
1b08a4d976
1 changed files with 32 additions and 18 deletions
|
@ -34,16 +34,21 @@ lib.fix (builders: {
|
||||||
*/
|
*/
|
||||||
writeLuaWith =
|
writeLuaWith =
|
||||||
pkgs: name: text:
|
pkgs: name: text:
|
||||||
pkgs.runCommand name { inherit text; } ''
|
pkgs.runCommand name
|
||||||
echo -n "$text" > "$out"
|
{
|
||||||
|
nativeBuildInputs = [ pkgs.stylua ];
|
||||||
${lib.getExe pkgs.stylua} \
|
passAsFile = [ "text" ];
|
||||||
--no-editorconfig \
|
inherit text;
|
||||||
--line-endings Unix \
|
}
|
||||||
--indent-type Spaces \
|
''
|
||||||
--indent-width 4 \
|
install -m 644 -T "$textPath" "$out"
|
||||||
"$out"
|
stylua \
|
||||||
'';
|
--no-editorconfig \
|
||||||
|
--line-endings Unix \
|
||||||
|
--indent-type Spaces \
|
||||||
|
--indent-width 4 \
|
||||||
|
"$out"
|
||||||
|
'';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Write a byte compiled lua file to the nix store.
|
Write a byte compiled lua file to the nix store.
|
||||||
|
@ -62,11 +67,15 @@ lib.fix (builders: {
|
||||||
*/
|
*/
|
||||||
writeByteCompiledLuaWith =
|
writeByteCompiledLuaWith =
|
||||||
pkgs: name: text:
|
pkgs: name: text:
|
||||||
pkgs.runCommandLocal name { inherit text; } ''
|
pkgs.runCommandLocal name
|
||||||
echo -n "$text" > "$out"
|
{
|
||||||
|
nativeBuildInputs = [ pkgs.luajit ];
|
||||||
${lib.getExe' pkgs.luajit "luajit"} -bd -- "$out" "$out"
|
passAsFile = [ "text" ];
|
||||||
'';
|
inherit text;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
luajit -bd -- "$textPath" "$out"
|
||||||
|
'';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get a source lua file and write a byte compiled copy of it
|
Get a source lua file and write a byte compiled copy of it
|
||||||
|
@ -86,9 +95,14 @@ lib.fix (builders: {
|
||||||
*/
|
*/
|
||||||
byteCompileLuaFileWith =
|
byteCompileLuaFileWith =
|
||||||
pkgs: name: src:
|
pkgs: name: src:
|
||||||
pkgs.runCommandLocal name { inherit src; } ''
|
pkgs.runCommandLocal name
|
||||||
${lib.getExe' pkgs.luajit "luajit"} -bd -- "$src" "$out"
|
{
|
||||||
'';
|
nativeBuildInputs = [ pkgs.luajit ];
|
||||||
|
inherit src;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
luajit -bd -- "$src" "$out"
|
||||||
|
'';
|
||||||
|
|
||||||
# Setup hook to byte compile all lua files in the output directory.
|
# Setup hook to byte compile all lua files in the output directory.
|
||||||
# Invalid lua files are ignored.
|
# Invalid lua files are ignored.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue