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 https://nixos.org/nix/install) --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
/bin/sh
The nixos.org quick install page promotes single user Nix, but that command (curl -L https://nixos.org/nix/install | sh
) simply uses pipes so:
$ curl -L https://nixos.org/nix/install > 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 https://github.com/nixos/nix/issues
Or feel free to contact the team,
- on Matrix #nix:nixos.org
- on IRC #nixos on irc.libera.chat
- on twitter @nixos_org
- on our forum https://discourse.nixos.org/