Saving it to file, and using that temporary file works fine,

$ url="https://raw.githubusercontent.com/toraritte/shell.nixes/main/deno-latest-shell.nix"

$ curl $url > default.nix

$ nix-shell
# or
$ nix-shell default.nix

but how can one do this without using a temporary file? Here's what I tried so far:


$ curl $url | nix-shell -

This downloads the file and the ... just nothing happens.

$ curl $url | nix-shell

This will throw an error that there is no default.nix (of course).

Process substitution

Using the <() operator (archive):

$ nix-shell <(curl $url)

# ... output...
error: getting status of '/dev/fd/pipe:[11284302]': No such file or directory

But when I change nix-shell to cat, it works, just as if I had saved the curl output into a regular file, and printed its contents.

(Maybe hitting the same issue with this approach that is explained in Why doesn't the process substitution <() work with ssh -F? The solution there was using zsh with its special =(...) operator, that basically uses a temporary file behind the scenes.)

I know there is nix-shell -E, but it would probably be problematic even if my specific example Nix expression didn't contain comments...


1 Answer 1


This looks like a Nix bug, here is a similar one for nix eval.

Until it is fixed, you can use nix-shell -E "$(curl $url)". Or just using Nix, nix-shell -E "import (builtins.fetchurl $url)".

Just please make sure you can trust the expression before executing it – the expression’s shellHook can contain arbitrary bash code and nix-shell will run it.

  • The second form of nix-shell -E works like a charm! I originally dismissed the first form of nix-shell -E because my shell.nix is heavily commented, but I was obviously just limited in my thinking. Thank you also for linking to the NixOS/nix issue! Haven't open a new issue for this, but updated it with this one for now.
    – toraritte
    Apr 6, 2021 at 11:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .