mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
31 lines
530 B
Nix
31 lines
530 B
Nix
|
{
|
||
|
lib,
|
||
|
pkgs,
|
||
|
}: {
|
||
|
/*
|
||
|
Write a lua file to the nix store, formatted using stylua.
|
||
|
|
||
|
# Type
|
||
|
|
||
|
```
|
||
|
writeLua :: String -> String -> Derivation
|
||
|
```
|
||
|
|
||
|
# Arguments
|
||
|
|
||
|
- [name] The name of the derivation
|
||
|
- [text] The content of the lua file
|
||
|
*/
|
||
|
writeLua = name: text:
|
||
|
pkgs.runCommand name {inherit text;} ''
|
||
|
echo -n "$text" > "$out"
|
||
|
|
||
|
${lib.getExe pkgs.stylua} \
|
||
|
--no-editorconfig \
|
||
|
--line-endings Unix \
|
||
|
--indent-type Spaces \
|
||
|
--indent-width 4 \
|
||
|
"$out"
|
||
|
'';
|
||
|
}
|