summary refs log tree commit diff
path: root/nixos/modules/services/ttys
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-12 18:29:06 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-12 18:52:10 +0100
commitd4122456016accdc2137c383bf7b40e6c016dd19 (patch)
tree6f20f66d670882b3afd751dc78e50760954ad35a /nixos/modules/services/ttys
parent691c0cd72e96cc6c75b46112c287b07bd571df26 (diff)
downloadnixlib-d4122456016accdc2137c383bf7b40e6c016dd19.tar
nixlib-d4122456016accdc2137c383bf7b40e6c016dd19.tar.gz
nixlib-d4122456016accdc2137c383bf7b40e6c016dd19.tar.bz2
nixlib-d4122456016accdc2137c383bf7b40e6c016dd19.tar.lz
nixlib-d4122456016accdc2137c383bf7b40e6c016dd19.tar.xz
nixlib-d4122456016accdc2137c383bf7b40e6c016dd19.tar.zst
nixlib-d4122456016accdc2137c383bf7b40e6c016dd19.zip
getty@ and autovt@: Use the upstream units
Diffstat (limited to 'nixos/modules/services/ttys')
-rw-r--r--nixos/modules/services/ttys/agetty.nix95
-rw-r--r--nixos/modules/services/ttys/kmscon.nix2
2 files changed, 20 insertions, 77 deletions
diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix
index 211008fa7e41..ca4fbeb0add3 100644
--- a/nixos/modules/services/ttys/agetty.nix
+++ b/nixos/modules/services/ttys/agetty.nix
@@ -48,82 +48,25 @@ with pkgs.lib;
 
   config = {
 
-    # FIXME: these are mostly copy/pasted from the systemd sources,
-    # which some small modifications, which is annoying.
-
-    # Generate a separate job for each tty.
-    systemd.units."getty@.service".text =
-      ''
-        [Unit]
-        Description=Getty on %I
-        Documentation=man:agetty(8)
-        After=systemd-user-sessions.service plymouth-quit-wait.service
-
-        # If additional gettys are spawned during boot then we should make
-        # sure that this is synchronized before getty.target, even though
-        # getty.target didn't actually pull it in.
-        Before=getty.target
-        IgnoreOnIsolate=yes
-
-        ConditionPathExists=/dev/tty0
-
-        [Service]
-        Environment=TERM=linux
-        Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
-        ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400
-        Type=idle
-        Restart=always
-        RestartSec=0
-        UtmpIdentifier=%I
-        TTYPath=/dev/%I
-        TTYReset=yes
-        TTYVHangup=yes
-        TTYVTDisallocate=yes # set to no to prevent clearing the screen
-        KillMode=process
-        IgnoreSIGPIPE=no
-
-        # Some login implementations ignore SIGTERM, so we send SIGHUP
-        # instead, to ensure that login terminates cleanly.
-        KillSignal=SIGHUP
-
-        X-RestartIfChanged=false
-      '';
-    
-    systemd.units."serial-getty@.service".text = let
-        speeds = with pkgs.lib; concatStringsSep "," (map toString config.services.mingetty.serialSpeed);
-      in ''
-        [Unit]
-        Description=Serial Getty on %I
-        Documentation=man:agetty(8) man:systemd-getty-generator(8)
-        BindsTo=dev-%i.device
-        After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
-
-        # If additional gettys are spawned during boot then we should make
-        # sure that this is synchronized before getty.target, even though
-        # getty.target didn't actually pull it in.
-        Before=getty.target
-        IgnoreOnIsolate=yes
-
-        [Service]
-        Environment=TERM=linux
-        Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
-        ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I ${speeds}
-        Type=idle
-        Restart=always
-        RestartSec=0
-        UtmpIdentifier=%I
-        TTYPath=/dev/%I
-        TTYReset=yes
-        TTYVHangup=yes
-        KillMode=process
-        IgnoreSIGPIPE=no
-
-        # Some login implementations ignore SIGTERM, so we send SIGHUP
-        # instead, to ensure that login terminates cleanly.
-        KillSignal=SIGHUP
-        
-        X-RestartIfChanged=false
-      '';
+    systemd.services."getty@" =
+      { baseUnit = pkgs.runCommand "getty.service" {}
+          ''
+            sed '/ExecStart/ d' < ${config.systemd.package}/example/systemd/system/getty@.service > $out
+          '';
+        serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400";
+        restartIfChanged = false;
+      };
+
+    systemd.services."serial-getty@" =
+      { baseUnit = pkgs.runCommand "serial-getty.service" {}
+          ''
+            sed '/ExecStart/ d' < ${config.systemd.package}/example/systemd/system/serial-getty@.service > $out
+          '';
+        serviceConfig.ExecStart =
+          let speeds = concatStringsSep "," (map toString config.services.mingetty.serialSpeed);
+          in "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I ${speeds}";
+        restartIfChanged = false;
+      };
 
     environment.etc = singleton
       { # Friendly greeting on the virtual consoles.
diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix
index eb68a3d95d8f..1857c69b76b4 100644
--- a/nixos/modules/services/ttys/kmscon.nix
+++ b/nixos/modules/services/ttys/kmscon.nix
@@ -62,7 +62,7 @@ in {
       X-RestartIfChanged=false
     '';
 
-    systemd.units."autovt@.service".linkTarget = "${config.systemd.units."kmsconvt@.service".unit}/kmsconvt@.service";
+    systemd.units."autovt@.service".baseUnit = "${config.systemd.units."kmsconvt@.service".unit}/kmsconvt@.service";
 
     systemd.services."systemd-vconsole-setup".restartIfChanged = false;