How to install multi-user Nix on Alpine?

tl;dr The multi-user installer won’t work because Alpine does not use systemd but there is already support for non-systemd init systems (see thread and Nix PR #3788), thanks to @daf’s time and effort.

(Not sure why the multi-user script doesn’t work in this case though…)

Just documenting this in case others run into it as well:

On a pristine Alpine install, so to one will need curl, xz, and bash to fail properly.

sudo apk add curl xz bash

First, the multi-user Nix installer in the Nix manual will give up:

$ sh <(curl -L --daemon
-sh: syntax error: unexpected "("

Maybe because there I tried it on a POSIX shell and <(...) is Bash process substitution which is not POSIX-compatible:
(please correct me if the above sentence doesn’t make sense - I think I understood why the above error, but could be that I’m just making things up)

alpine@ip-172-31-15-17:~/clones/floxdocs$ echo $SHELL

The quick install page promotes single user Nix, but that command (curl -L | sh) simply uses pipes so:

$ curl -L > install
$ sh install --daemon

sh install --daemon will fail first if Bash is not present (env: can't execute 'bash': No such file or directory), but when that is added, this will be the final word:

Switching to the Daemon-based Installer

---- oh no! --------------------------------------------------------------------
Sorry, the multi-user installation requires systemd on Linux (detected using /run/systemd/system)

We'd love to help if you need it.

If you can, open an issue at

Or feel free to contact the team,
 - on Matrix
 - on IRC #nixos on
 - on twitter @nixos_org
 - on our forum

It has been a while since the last release from master, and the installer on the site is for the latest release in the 2.3.x series.

The non-systemd tweaks in #3788 are one of several unreleased installer changes/fixes. Generally (not always, because sometimes work is backported), you can check one of the commits in a PR on github (Add a script to install nix on non-systemd systems. by crinklywrappr · Pull Request #3788 · NixOS/nix · GitHub) to see what branches/tags they’re present in.

If you only see it in master, you can either look for a backport PR, or pick out a specific change from the commit and go look to see if it is present in the latest tag or the maintenance branch for the current major release. @domenkozar

There is a community-maintained ~unstable installer built from the master branch currently available/updated at GitHub - numtide/nix-unstable-installer: A place to host Nix unstable releases. (if you want to try this out and are OK with the risks)


I was wondering why the installer wasn’t working, thanks for the explanation! I don’t have a need for this at the moment, just poking around, but appreciate the extra info (of which I was also unaware of). Thanks again!

1 Like