Installer error on Google Project IDX, sudo command not found
Platform
- [X] Linux:
- [ ] macOS
- [ ] WSL
Additional information
I'm using Project IDX and whatever I'm trying to install, I was given option to explore NIX first (tbh this is my first time hearing this word). I tried to install the python packages using NIX but, got error "NIX NOT FOUND," and then afterwards I went to the site of NIX to install it and rest can be understand in the Ouput
Output
Output
build-nanogpt-3262913:~/build-nanogpt{master}$ curl -L https://nixos.org/nix/install | sh -s -- --daemon
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 4052 100 4052 0 0 7506 0 --:--:-- --:--:-- --:--:-- 7506
downloading Nix 2.22.1 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.22.1/nix-2.22.1-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.ZC31gC5j1o'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.9M 100 21.9M 0 0 92.8M 0 --:--:-- --:--:-- --:--:-- 92.8M
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation
This installation tool will set up your computer with the Nix package
manager. This will happen in a few stages:
1. Make sure your computer doesn't already have Nix. If it does, I
will show you instructions on how to clean up your old install.
2. Show you what I am going to install and where. Then I will ask
if you are ready to continue.
3. Create the system users (uids [30001..30032]) and groups (gid 30000)
that the Nix daemon uses to run builds. To create system users
in a different range, exit and run this tool again with
NIX_FIRST_BUILD_UID set.
4. Perform the basic installation of the Nix files daemon.
5. Configure your shell to import special Nix Profile files, so you
can use Nix.
6. Start the Nix daemon.
Would you like to see a more detailed list of what I will do?
No TTY, assuming you would say yes :)
I will:
- make sure your computer doesn't already have Nix files
(if it does, I will tell you how to clean them up.)
- create local users (see the list above for the users I'll make)
- create a local group (nixbld)
- install Nix in to /nix
- create a configuration file in /etc/nix
- set up the "default profile" by creating some Nix-related files in
/root
- back up /etc/bashrc to /etc/bashrc.backup-before-nix
- update /etc/bashrc to include some Nix configuration
- back up /etc/zshrc to /etc/zshrc.backup-before-nix
- update /etc/zshrc to include some Nix configuration
- load and start a service (at /etc/systemd/system/nix-daemon.service
and /etc/systemd/system/nix-daemon.socket) for nix-daemon
Ready to continue?
No TTY, assuming you would say yes :)
---- let's talk about sudo -----------------------------------------------------
This script is going to call sudo a lot. Normally, it would show you
exactly what commands it is running and why. However, the script is
run in a headless fashion, like this:
$ curl -L https://nixos.org/nix/install | sh
or maybe in a CI pipeline. Because of that, I'm going to skip the
verbose output in the interest of brevity.
If you would like to
see the output, try like this:
$ curl -L -o install-nix https://nixos.org/nix/install
$ sh ./install-nix
~~> Checking for artifacts of previous installs
Before I try to install, I'll check for signs Nix already is or has
been installed on this system.
/tmp/nix-binary-tarball-unpack.ZC31gC5j1o/unpack/nix-2.22.1-x86_64-linux/install-systemd-multi-user.sh: line 60: systemctl: command not found
/tmp/nix-binary-tarball-unpack.ZC31gC5j1o/unpack/nix-2.22.1-x86_64-linux/install-systemd-multi-user.sh: line 61: systemctl: command not found
---- warning! ------------------------------------------------------------------
Nix already appears to be installed. This installer may run into issues.
If an error occurs, try manually uninstalling, then rerunning this script.
Uninstalling nix:
1. Delete the files Nix added to your system:
sudo rm -rf "/etc/nix" "/nix" "/root/.nix-profile" "/root/.nix-defexpr" "/root/.nix-channels" "/root/.local/state/nix" "/root/.cache/nix" "/home/user/.nix-profile" "/home/user/.nix-defexpr" "/home/user/.nix-channels" "/home/user/.local/state/nix" "/home/user/.cache/nix"
and that is it.
---- warning! ------------------------------------------------------------------
We did not detect systemd on your system. With a multi-user install
without systemd you will have to manually configure your init system to
launch the Nix daemon after installation.
Do you want to proceed with a multi-user installation?
No TTY, assuming you would say yes :)
---- Nix config report ---------------------------------------------------------
Temp Dir: /tmp/tmp.rCI3PED24Z
Nix Root: /nix
Build Users: 32
Build Group ID: 30000
Build Group Name: nixbld
build users:
Username: UID
nixbld1: 30001
nixbld2: 30002
nixbld3: 30003
nixbld4: 30004
nixbld5: 30005
nixbld6: 30006
nixbld7: 30007
nixbld8: 30008
nixbld9: 30009
nixbld10: 30010
nixbld11: 30011
nixbld12: 30012
nixbld13: 30013
nixbld14: 30014
nixbld15: 30015
nixbld16: 30016
nixbld17: 30017
nixbld18: 30018
nixbld19: 30019
nixbld20: 30020
nixbld21: 30021
nixbld22: 30022
nixbld23: 30023
nixbld24: 30024
nixbld25: 30025
nixbld26: 30026
nixbld27: 30027
nixbld28: 30028
nixbld29: 30029
nixbld30: 30030
nixbld31: 30031
nixbld32: 30032
Ready to continue?
No TTY, assuming you would say yes :)
~~> Setting up the build group nixbld
/tmp/nix-binary-tarball-unpack.ZC31gC5j1o/unpack/nix-2.22.1-x86_64-linux/install-multi-user: line 364: sudo: command not found
---- oh no! --------------------------------------------------------------------
Oh no, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.
:(
We'd love to help if you need it.
You can open an issue at
https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md
Or get in touch with the community: https://nixos.org/community
I believe IDX offers its own Nix integration, based on https://idx.dev/blog/article/nix-on-idx.
The article links this technical documentation as well.
I don't see any mention of using the nix command, so maybe what's going on is that IDX uses Nix to build a customizable but static environment that does not include Nix itself.
Nix already appears to be installed. in your installer log appears to contradict this, but that may just indicate the presence of aforementioned pre-built Nix store, or perhaps a previous failed installer run.
The lack of sudo indicates that you were not given sufficient control of the IDX environment, which is probably by design. Considering that Google manages your Nix store, could you ask them whether this is a use case they support?
Just to give more precision on the idx setup (as far as I know): it is indeed using Nix to install everything, and Nix should be available in the environment, but you're not supposed to install it yourself. Everything happens by modifying the .idx/dev.nix file mentioned here
Not sure what causes the "NIX NOT FOUND," message. It's probably related to the specific setup of IDX
Hi @DeepakKumarKhatri ,
I am on the IDX team and wanted to provide an answer here.
As already pointed out, you don't need to install nix on idx, it's already installed and available there, you are free to use the nix cli there and if your need a certain version that is different from the one we have installed by default, you can add it to your .idx/dev.nix file, e.g. pkgs.nixVersions.nix_2_XX however note that all builds will be handled by the daemon that as of today is at version 2.23.
That said, we don't require that developers build their code with nix, what we provide is a way for you to configure your developer toolchain/environment with nix, after that you're free to use the "native" build tools of your target platform, e.g. npm, gradle, maven, cargo, poetry, etc.
As for sudo, as @roberth correctly inferred, we don't currently provide sudo access and I would argue that it's for the most part useless inside IDX, i.e. you won't have write access to the filesystem outside of /home /tmp even with sudo. We have some ideas on relaxing these restrictions but it has not been prioritized as we've not seen much demand for it so far.
However one of the biggest hurdles with sudo is that it's ingrained in many developers' muscle memory so they naturally use sudo when it's actually not required, one such example.
If you have further questions feel free to ask them at https://community.idx.dev/
@vkryachko Thank you for going the extra mile and explaining the status. That's much appreciated.
It doesn't seem there's anything left to do here, so I'll go ahead and close this. If you have any questions, feel free to ask.