std icon indicating copy to clipboard operation
std copied to clipboard

Empty `*.nix` file under `cells/` makes `nix repl` → `:lf .` hang

Open michalrus opened this issue 3 years ago • 4 comments

Basically what the title says. I can provide a simple repro if needed. :cat2:

michalrus avatar Apr 05 '22 10:04 michalrus

I've seen that before, yes. Didn't dig into it further, yet.

blaggacao avatar Apr 20 '22 23:04 blaggacao

@michalrus maybe yo've still got a simple repro-repo laying around. Now, that we have nix debugger and such, and that I've got some.time, I may have a look at this to see, if we can short-cut this.

blaggacao avatar Sep 07 '22 19:09 blaggacao

@blaggacao :lf . no longer hangs, but now x86_64-linux.cell does, not sure if that’s incorrect.

If you git apply this patch to an empty git init’ed directory:

diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..55f81ee
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,11 @@
+{
+  inputs.std.url = "github:divnix/std/6109c146b3f25c639e1196eea13a6e9a7720f982";
+  inputs.nixpkgs.url = "github:nixos/nixpkgs/21de2b973f9fee595a7a1ac4693efff791245c34";
+  outputs = inputs: inputs.std.growOn {
+    inherit inputs;
+    cellsFrom = ./nix;
+    cellBlocks = [
+      (inputs.std.installables "packages")
+    ];
+  } {};
+}
diff --git a/nix/cell/packages.nix b/nix/cell/packages.nix
new file mode 100644
index 0000000..e69de29

And then run nix flake update

And then inside nix repl, run :lf . and x86_64-linux.cell – that hangs

michalrus avatar Sep 09 '22 10:09 michalrus

Thanks for this repro-case!

I played around a little and this seems to be a bug in nix that doesn't show proper error messages in the repl:

❯ nix repl
Welcome to Nix 2.9.3. Type :? for help.

nix-repl> void = import ./nix/cell/packages.nix

nix-repl> void  # hangs, too
❯ nix eval .\#x86_64-linux.cell
warning: Git tree '/tmp/repro-issue' is dirty
error: syntax error, unexpected end of file

       at /nix/store/x7gppvi709hq94rpfn9g5yp7vvzp632h-nix/cell/packages.nix:1:1:
(use '--show-trace' to show detailed location information)

Maybe you could file an upstream issue for this?

blaggacao avatar Sep 10 '22 01:09 blaggacao

I think there's nothing here for us to do on the std side.

blaggacao avatar Dec 18 '22 20:12 blaggacao