Unverified Commit b68a5c19 authored by Ramses's avatar Ramses Committed by GitHub
Browse files

kmscon: 9.3.3 -> 9.3.4, nixos/kmscon: remove dependency on agetty (#508807)

parents 8fa452bd 54f2c962
Loading
Loading
Loading
Loading
+37 −63
Original line number Diff line number Diff line
@@ -25,50 +25,28 @@ let
    text = cfg.extraConfig;
  };

  baseLoginOptions = "-p -- \\u";
  baseLoginOptions = "-p";

  agettyCmd =
  loginCmd =
    enableAutologin:
    "${lib.getExe' pkgs.util-linux "agetty"} ${
      lib.escapeShellArgs (
        [
          "--login-program"
          (toString gettyCfg.loginProgram)
          "--login-options"
          # these options are passed as a single parameter
          "${lib.optionalString enableAutologin "-f "}${baseLoginOptions}"
        ]
        ++ lib.optionals enableAutologin [
          "--autologin"
          gettyCfg.autologinUser
        ]
        ++ gettyCfg.extraArgs
        ++ [
          "--8bits"
          "--noclear"
          "--"
          "-"
        ]
      )
    } $TERM";
    "${gettyCfg.loginProgram} ${baseLoginOptions}${lib.optionalString enableAutologin " -f -- ${gettyCfg.autologinUser}"}";

  loginScript = pkgs.writers.writeDash "kmscon-login" ''
  loginScript = pkgs.writers.writeDash "kmscon-login" (
    lib.optionalString (gettyCfg.autologinUser != null && gettyCfg.autologinOnce) ''
      kms_tty=
      active_tty_file=/sys/class/tty/tty0/active
      if [ -f "$active_tty_file" ]; then
        read -r kms_tty < "$active_tty_file"
      fi

    ${lib.optionalString (gettyCfg.autologinUser != null && gettyCfg.autologinOnce) ''
      autologged="/run/kmscon.autologged"
      if [ "$kms_tty" = tty1 ] && [ ! -f "$autologged" ]; then
        touch "$autologged"
        exec ${agettyCmd true}
        exec ${loginCmd true}
      fi
    ''}

    exec ${agettyCmd (gettyCfg.autologinUser != null && !gettyCfg.autologinOnce)}
  '';
    ''
    + "exec ${loginCmd (gettyCfg.autologinUser != null && !gettyCfg.autologinOnce)}"
  );
in
{
  imports = [
@@ -182,9 +160,8 @@ in

    systemd.suppressedSystemUnits = [ "getty@.service" ];

    services.kmscon.extraConfig =
      let
        xkb = optionals cfg.useXkbConfig (
    services.kmscon.extraConfig = lib.concatLines (
      optionals cfg.useXkbConfig (
        lib.mapAttrsToList (n: v: "xkb-${n}=${v}") (
          lib.filterAttrs (
            n: v:
@@ -197,17 +174,14 @@ in
            && v != ""
          ) config.services.xserver.xkb
        )
        );
        render = optionals cfg.hwRender [
      )
      ++ optionals cfg.hwRender [
        "drm"
        "hwaccel"
        ];
        fonts =
          optional (cfg.fonts != null)
            "font-name=${lib.concatMapStringsSep ", " (f: f.name) cfg.fonts}";
        term = optional (cfg.term != null) "term=${cfg.term}";
      in
      lib.concatLines (xkb ++ render ++ fonts ++ term);
      ]
      ++ optional (cfg.fonts != null) "font-name=${lib.concatMapStringsSep ", " (f: f.name) cfg.fonts}"
      ++ optional (cfg.term != null) "term=${cfg.term}"
    );

    hardware.graphics.enable = mkIf cfg.hwRender true;

+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
  enableOCR = true;

  testScript = ''
    machine.start()
    machine.wait_for_unit("default.target")

    with subtest("ensure we can open a tty"):
      machine.wait_for_text("alice@machine")
+2 −2
Original line number Diff line number Diff line
@@ -29,13 +29,13 @@
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "kmscon";
  version = "9.3.3";
  version = "9.3.4";

  src = fetchFromGitHub {
    owner = "kmscon";
    repo = "kmscon";
    tag = "v${finalAttrs.version}";
    hash = "sha256-U9jDlZb5aBzQ7IErtLsajxcN1W5/8/eNwhGIuz7aUCw=";
    hash = "sha256-S6a/m2gfYOsacq4uq3d05WZPH1C8RQowmZM7f6On4ic=";
  };

  strictDeps = true;
+2 −2
Original line number Diff line number Diff line
@@ -12,13 +12,13 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "libtsm";
  version = "4.4.3";
  version = "4.5.0";

  src = fetchFromGitHub {
    owner = "kmscon";
    repo = "libtsm";
    tag = "v${finalAttrs.version}";
    hash = "sha256-AKwS088lP3dByKh3dQRW76+L6ouD8EmVms2qWIC5IiE=";
    hash = "sha256-5Lv/Hb0FGWARk3Wv3IuAbtCDII7qOMmcZSmKTkgTEsc=";
  };

  strictDeps = true;