Skip to content

treewide: Fix indentation in strings#350296

Merged
piegamesde merged 1 commit intoNixOS:masterfrom
piegamesde:string-fixes
Oct 23, 2024
Merged

treewide: Fix indentation in strings#350296
piegamesde merged 1 commit intoNixOS:masterfrom
piegamesde:string-fixes

Conversation

@piegamesde
Copy link
Copy Markdown
Member

@piegamesde piegamesde commented Oct 21, 2024

The indentation stripping semantics of strings are fairly bad and have a few gotchas where the resulting string has not the intended indentation. This commit fixes most if not all such instances in Nixpkgs.

I tried to strive a balance between keeping the diff small and reformatting/refactoring the code to look better. In general, reformatting should be left to Nixfmt.

Note that this causes a lot of rebuilds by design. All changes need to be thoroughly vetted and reviewed for correctness. There is no automatic way to prove correctness.

List of files to fix generated by running
https://gerrit.lix.systems/c/lix/+/2092 on Nixpkgs and looking at the warnings.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: flutter Open-source UI software development kit for cross-platform applications labels Oct 21, 2024
@piegamesde piegamesde marked this pull request as ready for review October 21, 2024 18:46
Copy link
Copy Markdown
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should split out all the meta changes to make this easier to merge faster?

@piegamesde piegamesde force-pushed the string-fixes branch 4 times, most recently from 4039087 to 19b40bb Compare October 21, 2024 19:48
@github-actions github-actions bot removed the 6.topic: flutter Open-source UI software development kit for cross-platform applications label Oct 21, 2024
@piegamesde
Copy link
Copy Markdown
Member Author

I took out some big packages, but this still has 36000 rebuilds. I've taken out some obvious candidates but I'm a bit at a loss now, so I'd appreciate any hints as to what may be causing these rebuilds.

@github-actions github-actions bot removed the 6.topic: haskell General-purpose, statically typed, purely functional programming language label Oct 21, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Oct 22, 2024
@piegamesde piegamesde force-pushed the string-fixes branch 3 times, most recently from 43193e6 to 987bf9b Compare October 22, 2024 09:08
@piegamesde
Copy link
Copy Markdown
Member Author

Result of nixpkgs-review pr 350296 run on x86_64-linux 1

9 packages failed to build:
  • datadog-agent
  • emscriptenPackages.libxml2
  • emscriptenPackages.libxml2.bin
  • emscriptenPackages.libxml2.dev
  • emscriptenPackages.libxml2.devdoc
  • emscriptenPackages.xmlmirror
  • emscriptenPackages.xmlmirror.doc
  • pony-corral
  • ponyc
47 packages built:
  • arion
  • arion.data
  • baresip
  • bottles
  • bottles-unwrapped
  • doodle
  • duc
  • gnunet
  • gnunet-gtk
  • gopsuinfo
  • grub2 (grub2_light)
  • grub2.debug (grub2_light.debug)
  • grub2_efi
  • grub2_efi.debug
  • grub2_pvgrub_image
  • grub2_xen
  • heroic
  • httpfs2
  • kcgi
  • leocad
  • libextractor
  • mangohud
  • mangohud.doc
  • mangohud.man
  • mindustry
  • mindustry-wayland
  • mkcl
  • openexrid-unstable
  • openexrid-unstable.dev
  • openexrid-unstable.lib
  • os-prober
  • pfixtools
  • povray
  • setbfree
  • taler-challenger
  • taler-exchange
  • taler-merchant
  • taler-sync
  • timeshift
  • tokyocabinet
  • tokyotyrant
  • toppler
  • vdrPlugins.xineliboutput
  • woeusb
  • woeusb-ng
  • woeusb-ng.dist
  • yabridge

AFAICT, ponyc is already broken on master (CC @kamilchm @patternspandemic @redvers). The emscriptenPackages failures look like an unrelated dependency failure to me (CC @jtojnar @qknight). The datadog-agent failure is mine and will be fixed with the next push (I fell for the exact same syntax gotcha again which I was trying to fix …)

@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. and removed 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Oct 22, 2024
Copy link
Copy Markdown
Member

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed through the build changes, looks good, only minor style comments.

Comment on lines 192 to 193
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not have correct indentation either. Maybe something like:

Suggested change
--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib/ ${lib.optionalString enableWayland ''
--set SDL_VIDEODRIVER wayland \
--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib/${lib.optionalString enableWayland ''
\
--set SDL_VIDEODRIVER wayland \

Though it probably does not matter.

The indentation stripping semantics of strings are fairly bad and have a
few gotchas where the resulting string has not the intended indentation.
This commit fixes most if not all such instances in Nixpkgs.

I tried to strive a balance between keeping the diff small and
reformatting/refactoring the code to look better. In general,
reformatting should be left to Nixfmt.

Note that this causes a lot of rebuilds by design. All changes need to
be thoroughly vetted and reviewed for correctness. There is no automatic
way to prove correctness.

List of files to fix generated by running
https://gerrit.lix.systems/c/lix/+/2092 on Nixpkgs and looking at the
warnings.
@piegamesde
Copy link
Copy Markdown
Member Author

@ofborg eval

@piegamesde piegamesde merged commit ad8d051 into NixOS:master Oct 23, 2024
piegamesde added a commit that referenced this pull request Oct 24, 2024
Follow-up on #350296 with the packages that cause big rebuilds and need
to go through staging.
@piegamesde piegamesde mentioned this pull request Dec 14, 2024
13 tasks
@piegamesde piegamesde mentioned this pull request Dec 23, 2024
13 tasks
@jfly jfly moved this from Todo to Approved in Nix formatting Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

5 participants