summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-18 20:47:31 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-18 20:47:31 +0200
commit5ee5aa1b909595133280580c9b2f0c32189e8894 (patch)
tree3cebb11954eea4576de2012241f23ffc3d73d9e3
parent01216884242c0322efa20fd727ad1b55e8489dff (diff)
downloadnixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.tar
nixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.tar.gz
nixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.tar.bz2
nixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.tar.lz
nixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.tar.xz
nixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.tar.zst
nixlib-5ee5aa1b909595133280580c9b2f0c32189e8894.zip
Make "nixos-container login" an alias of "machinectl login"
-rw-r--r--nixos/modules/virtualisation/container-config.nix31
-rw-r--r--nixos/modules/virtualisation/nixos-container.pl2
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:<path-to-container>/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") {