Skip to content

add --install flag that bootstraps via nix-installer#129

Draft
Mic92 wants to merge 1 commit intomasterfrom
install-flag
Draft

add --install flag that bootstraps via nix-installer#129
Mic92 wants to merge 1 commit intomasterfrom
install-flag

Conversation

@Mic92
Copy link
Copy Markdown
Member

@Mic92 Mic92 commented Mar 27, 2026

Collapses the two-step mkdir + curl-pipe-sh dance from the README into a single command. Defaults the store location to $XDG_DATA_HOME/nix and runs the NixOS nix-installer inside our user namespace with its new --rootless mode, so it sees a writable /nix without any real privilege.

The uid mapping for --install writes '0 1' instead of the usual identity map so the installer's EUID==0 checks pass; everything it creates still lands as the real user on the host filesystem since only one uid is mapped.

The installer binary is fetched via curl to keep the normal (network-free) operation of nix-user-chroot from gaining an HTTP+TLS dependency. NIX_USER_CHROOT_INSTALLER lets tests and offline users point at a local binary instead.

wait_for_child now returns the exit status rather than calling process::exit directly, so the parent can print the 'enter with...' hint only on a successful install.

Depends on NixOS/nix-installer#166 for the --rootless flag.

Collapses the two-step mkdir + curl-pipe-sh dance from the README
into a single command. Defaults the store location to
$XDG_DATA_HOME/nix and runs the NixOS nix-installer inside our user
namespace with its new --rootless mode, so it sees a writable /nix
without any real privilege.

The uid mapping for --install writes '0 <uid> 1' instead of the
usual identity map so the installer's EUID==0 checks pass; everything
it creates still lands as the real user on the host filesystem since
only one uid is mapped.

The installer binary is fetched via curl to keep the normal
(network-free) operation of nix-user-chroot from gaining an HTTP+TLS
dependency. NIX_USER_CHROOT_INSTALLER lets tests and offline users
point at a local binary instead.

wait_for_child now returns the exit status rather than calling
process::exit directly, so the parent can print the 'enter with...'
hint only on a successful install.

Depends on NixOS/nix-installer#166 for the
--rootless flag.
@Mic92 Mic92 marked this pull request as draft March 27, 2026 09:36
@Eveeifyeve
Copy link
Copy Markdown
Member

It would be great to have a test for this.

@Mic92
Copy link
Copy Markdown
Member Author

Mic92 commented Mar 27, 2026

Yeah, should be easy, I basically have a docker-based manual test script locally. But I would like to add the upstream feature to nix-installer first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants