nixpkgs/nixos/modules
Arian van Putten 3624bb5362 nixos-container: Force container to talk to host nix-daemon
When logging into a container by using
  nixos-container root-login
all nix-related commands in the container would fail, as they
tried to modify the nix db and nix store, which are mounted
read-only in the container.  We want nixos-container to not
try to modify the nix store at all, but instead delegate
any build commands to the nix daemon of the host operating system.

This already works for non-root users inside a nixos-container,
as it doesn't 'own' the nix-store, and thus defaults
to talking to the daemon socket at /nix/var/nix/daemon-socket/,
which is bind-mounted to the host daemon-socket, causing all nix
commands to be delegated to the host.

However, when we are the root user inside the container, we have the
same uid as the nix store owner, eventhough it's not actually
the same root user (due to user namespaces). Nix gets confused,
and is convinced it's running in single-user mode, and tries
to modify the nix store directly instead.

By setting `NIX_REMOTE=daemon` in `/etc/profile`, we force nix
to operate in multi-user mode, so that it will talk to the host
daemon instead, which will modify the nix store for the container.

This fixes #40355
2018-10-05 18:36:47 +02:00
..
config Merge branch 'master' into staging-next 2018-09-13 10:08:53 +02:00
hardware Merge pull request #42846 from ambrop72/optimus-prime-config-master 2018-10-03 22:56:53 -05:00
i18n/input-method docs: format 2018-09-29 20:51:11 -04:00
installer nixos-option: fix #47722 when missing ~/.nix-defexpr/channels 2018-10-04 16:52:17 +02:00
misc lidarr: init at 0.3.1.471 2018-09-29 21:40:29 +02:00
profiles nixos: Fix eval error for documentation.nixos 2018-09-25 23:39:44 +02:00
programs docs: format 2018-09-29 20:51:11 -04:00
security Merge pull request #47563 from jameysharp/unscripted 2018-10-02 19:21:34 +01:00
services Merge branch 'master' into f/activation 2018-10-05 10:08:56 +08:00
system Merge branch 'master' into f/activation 2018-10-05 10:08:56 +08:00
tasks networking.hostId: fix cmd in description 2018-09-11 11:29:04 +02:00
testing Add ssh backdoor to VM tests infrastructure. 2018-09-28 10:53:08 +01:00
virtualisation nixos-container: Force container to talk to host nix-daemon 2018-10-05 18:36:47 +02:00
module-list.nix Merge pull request #47159 from eqyiel/nextcloud 2018-10-03 23:42:40 +01:00
rename.nix kubernetes: 1.11.3 -> 1.12.0 2018-09-30 14:49:26 +02:00