NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.91k stars 1.53k forks source link

Suggested `curl | sh` leaves no TTY for interactive installer #11714

Open wizardfrag opened 1 month ago

wizardfrag commented 1 month ago

Problem

When viewing the installation instructions for macOS, they suggest we run:

curl -L https://nixos.org/nix/install | sh

However, this causes the installer to assume "yes" to everything (at least with zsh on macOS Sonoma 14.7), which might be fine for most users, however I believe most would want to be able to interact with the installer? The output of the installer includes No TTY, assuming you would say yes :).

Proposal

Could the documentation be changed to either a "curl and inspect" type flow, or:

sh <(curl -L https://nixos.org/nix/install)

Leaving stdin/out available to the TTY.

Checklist

Priorities

Add :+1: to issues you find important.

abathur commented 1 month ago

It was this way previously. Interactive mode was collateral damage in this change for compatibility with fish shell:

Edit:

I'm not suggesting anyone close this. Just connecting dots.

I would personally prefer the recommended instructions lead to an interactive install in line with wizardfrag's reasoning. But I agree that broad compatibility is the higher priority and don't want to see people waste energy oscillating between the same two suboptimal outcomes.

AFAIK there's not a broadly portable one-line syntax for this, so I imagine the Goldilocks zone here probably entails one of a few larger changes to the install instructions:

  1. Just list instructions for multiple shells linearly in separate sections / code boxes.
  2. Try to find an efficient UI idiom (i.e., a tabbed widget) to achieve the same without making the instructions look more complicated. (I imagine it needs to be ~accessible and use styles/syntax that are viable everywhere we show the instructions? I think a few locations already use a tabbed form to communicate platform-specific differences, so any additional selecting interface also needs to combine well with them.)
  3. Decompose the oneliner (i.e., separate curl, sh, rm lines) to avoid syntax idioms that differ between shells.

Anything here is also inflected by the fact that there are currently quite a few copies of the instructions (including platform-specific variants) across multiple repos/sites atm (though I've seen @fricklerhandwerk say he'd like to reduce the number).

fricklerhandwerk commented 1 month ago

@Abathur I agree on everything, and while shell specific instructions would be best, we'd be left with a 2D-Matrix which would be really annoying to implement UI-wise. Generally, there are too damn many moving parts and ways of doing things.

wizardfrag commented 1 month ago

@abathur thanks for your reply, I wasn't aware of the issue with fish shell. I think perhaps the least impactful way to deal with it might be to add a note that it runs in non-interactive mode, and to suggest finding alternate ways of running if you want interactive mode? Something like (pseudo-docs):

Install Nix via the recommended multi-user installation:

curl -L https://nixos.org/nix/install | sh

Note: This command runs non-interactively and will install nix without prompt. If you wish to verify the commands that are run, we recommend fetching the install script and then running it.

Otherwise, I think this issue can probably be closed, since it's not super important. I just noticed it and thought it was worth raising 😄