Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flakes devShells recently broke with weird error #138157

Closed
NobbZ opened this issue Sep 16, 2021 · 9 comments · Fixed by #138334
Closed

Flakes devShells recently broke with weird error #138157

NobbZ opened this issue Sep 16, 2021 · 9 comments · Fixed by #138334

Comments

@NobbZ
Copy link
Contributor

NobbZ commented Sep 16, 2021

Describe the bug

Trying to enter a devshell for a flake errors weirdly:

error: [json.exception.parse_error.101] parse error at line 55, column 178: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '" \n    local fn=\"$1\";\n    local fd;\n    local magic;\n    exec {fd}< \"$fn\";\n    read -r -n 4 -u \"$fd\" magic;\n    exec {fd}>&-;\n    if [[ \"$magic\" = '�'

Steps To Reproduce

  1. Use nixUnstable with experimental features for flakes and nix-command enabled
  2. Use flake.nix from below
  3. run nix develop in the flake.

Expected behavior

A dev shell is entered that has gcc

Additional context

This has been observed so far on nixpkgs-unstable, nixos-unstable and master.

Personall I was able to confirm with the following commits (of which I can't say anmore which branch they belong to:

I have to admit though, that we are not sure if this is a problem of nixUnstable or nixpkgs.

What I can say though we had at least 2 versions of nix (nightly as shown below and 2.4pre20210908_3c56f62) in the mix and it broke for both of them.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix shell nixpkgs#nix-info -c nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.64, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20210915_1ec4efa`
 - channels(root): `"nixos-20.09beta1346.05334ad7852"`
 - channels(demo): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@holmesmr
Copy link
Contributor

The cause of this seems to be the Flake profile containing a bashFunction for isMachO which contains unescaped bytes which are not valid UTF-8 codepoints: NixOS/nix#4984 (comment)

@winterqt
Copy link
Member

winterqt commented Sep 16, 2021

The cause of this seems to be the Flake profile containing a bashFunction for isMachO which contains unescaped bytes which are not valid UTF-8 codepoints: NixOS/nix#4984 (comment)

That's correct, yeah.

See #138186 for a temporary fix while the Nix issue is figured out, and NixOS/nix#5262 for details on the underlying Nix issue. (which I now realize is possibly a duplicate of the issue you linked? Not sure.)

@winterqt
Copy link
Member

I've made a temporary fix for this issue, which just involves patching Nix (as opposed to patching stdenv and requiring a full rebuild): nix-community/nix-direnv#113 (comment).

@vcunat vcunat linked a pull request Sep 19, 2021 that will close this issue
12 tasks
anirudhb added a commit to anirudhb/nixos-configs that referenced this issue Sep 23, 2021
See NixOS/nixpkgs#138157, isMachO function contains an invalid UTF-8
character. This adds the temporary Nix patch from [this
comment](nix-community/nix-direnv#113 (comment))
until their actual fix trickles down to nixpkgs master.
g00pix added a commit to g00pix/nixconf that referenced this issue Oct 6, 2021
Credit to CRI EPITA for basic overlay code (from Nix PIE). This is a
temporary workaround for NixOS/nixpkgs#138157.
@dcarosone
Copy link

This reappeared for me recently, after waiting several weeks for the fix to bubble through staging-next, it was finally gone - but now it's back:

$ nix develop
error: [json.exception.parse_error.101] parse error at line 55, column 178: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '" \n    local fn=\"$1\";\n    local fd;\n    local magic;\n    exec {fd}< \"$fn\";\n    read -r -n 4 -u \"$fd\" magic;\n    exec {fd}>&-;\n    if [[ \"$magic\" = '�'

@winterqt
Copy link
Member

@dcarosone What Nixpkgs commit? I cannot reproduce on commit 8e1eab9.

@dcarosone
Copy link

dcarosone commented Oct 17, 2021

It reappeared a couple of days ago, not entirely sure which commit. I had a big update with GNOME 41 that caused a bunch of other issues this morning

21.11pre323079. 2cf9db0

@dcarosone
Copy link

Hm. After removing flake.lock it appears to be ok again. Weird.

@winterqt
Copy link
Member

@NobbZ I think we should be fine closing this issue by this point.

@NobbZ
Copy link
Contributor Author

NobbZ commented Oct 17, 2021

The issue hasn't been mentioned in a while in the discord, thats true.

@NobbZ NobbZ closed this as completed Oct 17, 2021
patrickod added a commit to patrickod/nix-config that referenced this issue Dec 3, 2021
* fixed brightness control in i3
* fixed memory/swap i3status format
* added battery block to i3status
* patched nix for flake bug RE NixOS/nixpkgs#138157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants