From 5ee5aa1b909595133280580c9b2f0c32189e8894 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 18 Apr 2014 20:47:31 +0200 Subject: [PATCH] Make "nixos-container login" an alias of "machinectl login" --- .../virtualisation/container-config.nix | 31 ++----------------- .../modules/virtualisation/nixos-container.pl | 2 +- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix index 35f8a03f1923..76e4b5612184 100644 --- a/nixos/modules/virtualisation/container-config.nix +++ b/nixos/modules/virtualisation/container-config.nix @@ -13,34 +13,9 @@ with lib; # Shut up warnings about not having a boot loader. system.build.installBootLoader = "${pkgs.coreutils}/bin/true"; - # Provide a login prompt on /var/lib/login.socket. On the host, - # you can connect to it by running ‘socat - # unix:/var/lib/login.socket -,echo=0,raw’. - systemd.sockets.login = - { description = "Login Socket"; - wantedBy = [ "sockets.target" ]; - socketConfig = - { ListenStream = "/var/lib/login.socket"; - SocketMode = "0666"; - Accept = true; - }; - }; - - systemd.services."login@" = - { description = "Login %i"; - environment.TERM = "linux"; - serviceConfig = - { Type = "simple"; - StandardInput = "socket"; - ExecStart = "${pkgs.socat}/bin/socat -t0 - exec:${pkgs.shadow}/bin/login,pty,setsid,setpgid,stderr,ctty"; - TimeoutStopSec = 1; # FIXME - }; - restartIfChanged = false; - }; - - # Also provide a root login prompt on /var/lib/root-login.socket - # that doesn't ask for a password. This socket can only be used by - # root on the host. + # Provide a root login prompt on /var/lib/root-login.socket that + # doesn't ask for a password. This socket can only be used by root + # on the host. systemd.sockets.root-login = { description = "Root Login Socket"; wantedBy = [ "sockets.target" ]; diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl index f04b2b3e74e2..2fd41a340962 100644 --- a/nixos/modules/virtualisation/nixos-container.pl +++ b/nixos/modules/virtualisation/nixos-container.pl @@ -203,7 +203,7 @@ elsif ($action eq "update") { } elsif ($action eq "login") { - exec($socat, "unix:$root/var/lib/login.socket", "-,echo=0,raw"); + exec("machinectl", "login", "--", $containerName); } elsif ($action eq "root-login") {