mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
output: format init.lua
This commit is contained in:
parent
3a4de0bb2f
commit
21c233919d
3 changed files with 34 additions and 1 deletions
30
lib/builders.nix
Normal file
30
lib/builders.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
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"
|
||||||
|
'';
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
_nixvimTests,
|
_nixvimTests,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
nixvimBuilders = import ./builders.nix {inherit lib pkgs;};
|
||||||
nixvimTypes = import ./types.nix {inherit lib nixvimOptions;};
|
nixvimTypes = import ./types.nix {inherit lib nixvimOptions;};
|
||||||
nixvimUtils = import ./utils.nix {inherit lib _nixvimTests;};
|
nixvimUtils = import ./utils.nix {inherit lib _nixvimTests;};
|
||||||
nixvimOptions = import ./options.nix {inherit lib nixvimTypes nixvimUtils;};
|
nixvimOptions = import ./options.nix {inherit lib nixvimTypes nixvimUtils;};
|
||||||
|
@ -20,3 +21,4 @@ in
|
||||||
}
|
}
|
||||||
// nixvimUtils
|
// nixvimUtils
|
||||||
// nixvimOptions
|
// nixvimOptions
|
||||||
|
// nixvimBuilders
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
helpers,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib; {
|
||||||
|
@ -115,7 +116,7 @@ with lib; {
|
||||||
''
|
''
|
||||||
+ config.content;
|
+ config.content;
|
||||||
|
|
||||||
init = pkgs.writeText "init.lua" customRC;
|
init = helpers.writeLua "init.lua" customRC;
|
||||||
initPath = toString init;
|
initPath = toString init;
|
||||||
|
|
||||||
extraWrapperArgs = builtins.concatStringsSep " " (
|
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue