Skip to content

Commit

Permalink
nixos-container: use systemd-run instead of nsenter
Browse files Browse the repository at this point in the history
This is the first step for unprivileged nixos containers support.
Fixes NixOS#30019. See also NixOS#18825, NixOS#57083, and NixOS#67130.
  • Loading branch information
uvNikita committed Aug 23, 2019
1 parent f096e5a commit 7cb100b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkgs/tools/virtualization/nixos-container/nixos-container.pl
Expand Up @@ -9,7 +9,6 @@
use Cwd 'abs_path';
use Time::HiRes;

my $nsenter = "@utillinux@/bin/nsenter";
my $su = "@su@";

# Ensure a consistent umask.
Expand Down Expand Up @@ -270,9 +269,10 @@ sub restartContainer {
# Run a command in the container.
sub runInContainer {
my @args = @_;
my $leader = getLeader;
exec($nsenter, "-t", $leader, "-m", "-u", "-i", "-n", "-p", "--", @args);
die "cannot run ‘nsenter’: $!\n";

exec("systemd-run", "--machine", $containerName, "--pty", "--quiet", "--", @args);

die "cannot run ‘systemd-run’: $!\n";
}

# Remove a directory while recursively unmounting all mounted filesystems within
Expand Down

0 comments on commit 7cb100b

Please sign in to comment.