Skip to content

Commit 2757cd2

Browse files
committed
feat: optionally style init.lua
1 parent ffa3020 commit 2757cd2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

wrappers/modules/output.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ with lib; {
3434
description = "Neovim to use for NixVim.";
3535
};
3636

37+
styleInit = mkOption {
38+
type = types.bool;
39+
default = false;
40+
description = "Style the `init.lua` file.";
41+
};
42+
3743
wrapRc = mkOption {
3844
type = types.bool;
3945
description = "Should the config be included in the wrapper script.";
@@ -115,7 +121,17 @@ with lib; {
115121
''
116122
+ config.content;
117123

118-
init = pkgs.writeText "init.lua" customRC;
124+
initRaw = pkgs.writeText "init.lua" customRC;
125+
initStyled =
126+
pkgs.runCommand "init.lua" {
127+
buildInputs = [pkgs.stylua];
128+
} ''
129+
cat ${initRaw} | stylua - > $out
130+
'';
131+
init =
132+
if config.styleInit
133+
then initStyled
134+
else initRaw;
119135
initPath = toString init;
120136

121137
extraWrapperArgs = builtins.concatStringsSep " " (

0 commit comments

Comments
 (0)