Gtkgreet (or regreeter) with greetd with Hyprland

I have been spelunking code today, looking for a good example of leveraging Gtkgreet with Greetd to start a Hyprland session.

I, for the life of me, cannot get it working. I have things working with tuigreet but I was looking to make things feel a little more put together.

Is anyone using this combo? If so, a link to a repo?

What I currently have:

greetd = {
      enable = true;
      restart = false;
      settings = {
        default_session = {
          command = ''
              lib.makeBinPath [ pkgs.greetd.tuigreet ]
            }/tuigreet -r --asterisks --time \
              --cmd ${runner}

and the runner is:

  hypr-run = pkgs.writeShellScriptBin "hypr-run" ''
    export XDG_SESSION_TYPE="wayland"
    export XDG_SESSION_DESKTOP="Hyprland"
    export XDG_CURRENT_DESKTOP="Hyprland"

    systemd-run --user --scope --collect --quiet --unit="hyprland" \
        systemd-cat --identifier="hyprland" ${pkgs.hyprland}/bin/Hyprland $@

    ${pkgs.hyprland}/bin/hyperctl dispatch exit
in {
  imports = [
    (import ./tiling-common {
      inherit lib pkgs inputs;
      runner = (lib.getExe hypr-run);

Now, based on:

λ gtkgreet --help
  gtkgreet [OPTION…] - GTK-based greeter for greetd

Help Options:
  -h, --help               Show help options
  --help-all               Show all help options
  --help-gtk               Show GTK+ Options

Application Options:
  -l, --layer-shell        Use layer shell
  -c, --command=sway       Command to run
  -b, --background         Background image to use
  -s, --style              CSS style to use
  --display=DISPLAY        X display to use

I had thought I could just:

greetd = {
      enable = true;
      restart = false;
      settings = {
        default_session = {
          command = ''
              lib.makeBinPath [ pkgs.greetd.gtkgreet ]
            }/gtkgreet --layer-shell --command=${runner}

But the login session fails, and I either have to reboot to a previous stage or ctrl-alt-f2 into another login.



I have a similar but different setup. I’m using Hyprland, swaylock, but experimented with gtkgreet. I wasn’t able to get gtkgreet to start the Hyprland session. I then tried calling “exec-once gtkgreet -l -c Hyprland” from my ~/.config/hypr/hyprland.conf file, but that didn’t quite work.

I’ve settled on just using swaylock since my use case is a single user and single session environment (Hyprland), so the extra choices of user and environment aren’t needed…all I’m after is authentication.

Merged PR with Swaylock

That hash of the repo/tree shows the home-manager configuration (hyprland.conf) and the nix configuration file (modules/desktop/hyprland/default.nix).

This configuration logins in automatically to “iancleary” (my username) and then the hyprland.conf calls “exec-once swaylock” to prompt for authentication.