1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 02:43:54 +02:00

Format .nix files

This does not include any automation for the release branch, but
is based on the configuration of https://github.com/NixOS/nix/pull/12349

    pre-commit run -a nixfmt-rfc-style
This commit is contained in:
Robert Hensing 2025-01-24 20:26:47 +01:00
parent 42b22fe3de
commit 2f1b70a529
259 changed files with 7729 additions and 5286 deletions

View file

@ -16,16 +16,17 @@ let
it doesn't matter).
'';
s2 = '' If the string starts with whitespace
followed by a newline, it's stripped, but
that's not the case here. Two spaces are
stripped because of the " " at the start.
s2 = ''
If the string starts with whitespace
followed by a newline, it's stripped, but
that's not the case here. Two spaces are
stripped because of the " " at the start.
'';
s3 = ''
This line is indented
a bit further.
''; # indentation of last line doesn't count if it's empty
This line is indented
a bit further.
''; # indentation of last line doesn't count if it's empty
s4 = ''
Anti-quotations, like ${if true then "so" else "not so"}, are
@ -40,11 +41,11 @@ let
If you want them, use anti-quotations: ${"''"}, ${"\${"}.
'';
s6 = ''
Tabs are not interpreted as whitespace (since we can't guess
what tab settings are intended), so don't use them.
This line starts with a space and a tab, so only one
space will be stripped from each line.
s6 = ''
Tabs are not interpreted as whitespace (since we can't guess
what tab settings are intended), so don't use them.
This line starts with a space and a tab, so only one
space will be stripped from each line.
'';
s7 = ''
@ -52,36 +53,38 @@ let
consists only of whitespace, it's ignored. But here there is
some non-whitespace stuff, so the line isn't removed. '';
s8 = '' ${""}
s8 = ''
${""}
This shows a hacky way to preserve an empty line after the start.
But there's no reason to do so: you could just repeat the empty
line.
'';
s9 = ''
${""} Similarly you can force an indentation level,
in this case to 2 spaces. This works because the anti-quote
is significant (not whitespace).
${""} Similarly you can force an indentation level,
in this case to 2 spaces. This works because the anti-quote
is significant (not whitespace).
'';
s10 = ''
'';
s10 = '''';
s11 = '''';
s12 = '' '';
s12 = '''';
s13 = ''
start on network-interfaces
start script
rm -f /var/run/opengl-driver
${if true
then "ln -sf 123 /var/run/opengl-driver"
else if true
then "ln -sf 456 /var/run/opengl-driver"
else ""
${
if true then
"ln -sf 123 /var/run/opengl-driver"
else if true then
"ln -sf 456 /var/run/opengl-driver"
else
""
}
rm -f /var/log/slim.log
@ -94,11 +97,13 @@ let
env XKB_BINDIR=${"foo"}/bin # Needed for the Xkb extension.
env LD_LIBRARY_PATH=${"libX11"}/lib:${"libXext"}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)
${if true
then "env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/"
else if true
then "env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri"
else ""
${
if true then
"env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/"
else if true then
"env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri"
else
""
}
exec ${"slim"}/bin/slim
@ -111,18 +116,23 @@ let
'';
# Regression test: string interpolation in '${x}' should work, but didn't.
s15 = let x = "bla"; in ''
foo
'${x}'
bar
'';
s15 =
let
x = "bla";
in
''
foo
'${x}'
bar
'';
# Regression test: accept $'.
s16 = ''
cut -d $'\t' -f 1
'';
# Accept dollars at end of strings
# Accept dollars at end of strings
s17 = ''ending dollar $'' + ''$'' + "\n";
in s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 + s16 + s17
in
s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 + s16 + s17