SC2162 (info): read without -r will mangle backslashes

Hi - fiddled around with my nix-darwin config and now I get this error:

error: builder for '/nix/store/djgk8cklcxjwiiazgsll2nw226xp0xkw-darwin-system-24.11.20241105.8c4dc69+darwin5.158198a.drv' failed with exit code 1;
       last 7 log lines:
       >
       > In /nix/store/d5vrnjr93vqpd8bik95mqr6l79zv7ndl-darwin-system-24.11.20241105.8c4dc69+darwin5.158198a/activate line 1322:
       > while read src; do
       >       ^--^ SC2162 (info): read without -r will mangle backslashes.

And I don’t even remotely have a clue on the where to start to look to sort that.
Ive think reverted back to the config that worked but still the same error - any pointers in the right direction is greatly appreciated.

/Anders

I solved with git instead. Reverting to an earlier commit works.
If somebody could shed some light on the error that would be awesome!

Found that was due to a nix flake update so something is borked in latest update for nix-darwin.

The error itself is coming from shellcheck, which it does look like nix-darwin will run the activation script through–and it does look like this was merged about an hour before your post:

I don’t see while read src in the nix-darwin source, so I think the script it’s objecting to is coming in from either your local config or maybe some other module you’re including.

You can see some post-merge comments in the PR thread above for other people reporting the same issue and recommendations from maintainers.

1 Like

Awesome thanks for the reply - I’ll take a look and if that helps. Most like there is a dependency in one of my modules.

So indeed I had an script using read src only thing needed to get it work again was to add read -r src