NixOS / nix

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

Nix installer is way too verbose #6329

Open edolstra opened 2 years ago

edolstra commented 2 years ago

Generally Unix commands should be quiet unless they have something interesting to say (like error messages). By contrast, the Nix installer prints hundreds of lines like:

~~> Setting up the build user nixbld31

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo useradd --home-dir /var/empty --comment Nix build user 31 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30031 --password ! nixbld31

Creating the Nix build user, nixbld31

           Created:     Yes
            Hidden:     Yes
    Home Directory:     /var/empty

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo usermod --comment Nix build user 31 nixbld31

in order to give nixbld31 a useful comment

usermod: no changes
              Note:     Nix build user 31
   Logins Disabled:     Yes
  Member of nixbld:     Yes
    PrimaryGroupID:     30000

This drowns out useful information. I think it would be better to print only major steps and config info, e.g.

Unpacking /nix/store...
Creating nixbld* user accounts starting at UID 30000...
Installing systemd service /etc/systemd/system/nix-daemon.service...
Updating /etc/bash.bashrc...

If a command fails, the exact command should be printed. And maybe it could keep a log containing all executed commands.

06kellyjac commented 2 years ago

:+1: that'll make it more user friendly. Might be worth having a verbose option though?

abathur commented 2 years ago

While it's still somewhat verbose, the multiuser installer does output less information when "headless" (when FD 0 is not open). This, for example, omits the sudo blocks like:

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo usermod --comment Nix build user 31 nixbld31

in order to give nixbld31 a useful comment

You can see an example of how it differs in any of the CI runs using install-nix-action, i.e. https://github.com/NixOS/nix/runs/5677772364?check_suite_focus=true#step:4:94

tomberek commented 2 years ago

From NixUX: Blocked until we have a better installation testing framework.

abathur commented 2 years ago

From NixUX: Blocked until we have a better installation testing framework.

FWIW there are a fair number of material installer improvents that are not technically hard that I personally consider to be ~blocked on better testing. The installer tests reduced uncertainty a lot--for the golden path. But most of the support load is in the edge cases.