Skip to content

Commit d1769e3

Browse files
committed
luarocks-packages-updater: nixfmt-rfc-style output formatting
1 parent 3654cda commit d1769e3

File tree

1 file changed

+17
-9
lines changed
  • pkgs/by-name/lu/luarocks-packages-updater

1 file changed

+17
-9
lines changed

pkgs/by-name/lu/luarocks-packages-updater/updater.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ def format(self, record):
5050
TMP_FILE = "$(mktemp)"
5151
GENERATED_NIXFILE = "pkgs/development/lua-modules/generated-packages.nix"
5252

53-
HEADER = """/* {GENERATED_NIXFILE} is an auto-generated file -- DO NOT EDIT!
54-
Regenerate it with: nix run nixpkgs#luarocks-packages-updater
55-
You can customize the generated packages in pkgs/development/lua-modules/overrides.nix
53+
HEADER = """/*
54+
{GENERATED_NIXFILE} is an auto-generated file -- DO NOT EDIT!
55+
Regenerate it with: nix run nixpkgs#luarocks-packages-updater
56+
You can customize the generated packages in pkgs/development/lua-modules/overrides.nix
5657
*/
5758
""".format(GENERATED_NIXFILE=GENERATED_NIXFILE)
5859

5960
FOOTER = """
6061
}
61-
/* GENERATED - do not edit this file */
62+
# GENERATED - do not edit this file
6263
"""
6364

6465

@@ -118,10 +119,16 @@ def generate_nix(self, results: list[tuple[LuaPlugin, str]], outfilename: str):
118119
with tempfile.NamedTemporaryFile("w+") as f:
119120
f.write(HEADER)
120121
header2 = textwrap.dedent(
121-
"""
122-
{ stdenv, lib, fetchurl, fetchgit, callPackage, ... }:
123-
final: prev:
124-
{
122+
"""
123+
{
124+
stdenv,
125+
lib,
126+
fetchurl,
127+
fetchgit,
128+
callPackage,
129+
...
130+
}:
131+
final: prev: {
125132
"""
126133
)
127134
f.write(header2)
@@ -231,7 +238,8 @@ def generate_pkg_nix(plug: LuaPlugin):
231238
log.debug("running %s", " ".join(cmd))
232239

233240
output = subprocess.check_output(cmd, text=True)
234-
output = "callPackage(" + output.strip() + ") {};\n\n"
241+
## FIXME: luarocks nix command output isn't formatted properly
242+
output = "callPackage(\n" + output.strip() + ") {};\n\n"
235243
return (plug, output, None)
236244
except subprocess.CalledProcessError as e:
237245
log.error("Failed to generate nix expression for %s: %s", plug.name, e)

0 commit comments

Comments
 (0)