0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

Containers: Use nsenter to execute commands in containers

Also remove ‘nixos-container set-root-password’, which is kind of
pointless now.
This commit is contained in:
Eelco Dolstra 2014-08-27 19:31:22 +02:00
parent 9c7a598713
commit 6773babd5b
3 changed files with 23 additions and 95 deletions

View file

@ -10,7 +10,7 @@ let
isExecutable = true;
src = ./nixos-container.pl;
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
inherit (pkgs) socat;
inherit (pkgs) utillinux;
};
# The container's init script, a small wrapper around the regular
@ -254,9 +254,8 @@ in
ExecReload = pkgs.writeScript "reload-container"
''
#! ${pkgs.stdenv.shell} -e
SYSTEM_PATH=/nix/var/nix/profiles/system
echo $SYSTEM_PATH/bin/switch-to-configuration test | \
${pkgs.socat}/bin/socat unix:$root/var/lib/run-command.socket -
${nixos-container}/bin/nixos-container run "$INSTANCE" -- \
bash --login -c "/nix/var/nix/profiles/system/bin/switch-to-configuration test"
'';
SyslogIdentifier = "container %i";