summary refs log tree commit diff
path: root/mixins/greet.nix
blob: fc1d151ddffa0d2f228fc363d896b3f3a3603fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  config,
  pkgs,
  lib,
  ...
}: let
  user = "tzlil";

  users.users.greeter.packages = [pkgs.sway];
  greet = "${pkgs.greetd.wlgreet}/bin/wlgreet";

  sway-kiosk = command: "env WLR_RENDERER=pixman ${pkgs.sway}/bin/sway --unsupported-gpu --config ${pkgs.writeText "kiosk.config" ''
    output * bg #000000 solid_color
    exec "${command}; ${pkgs.sway}/bin/swaymsg exit"
  ''}";
in {
  options.greeter.initialSession = lib.mkOption {
    type = lib.types.str;
    default = "sh -c ${pkgs.sway}/bin/sway";
  };

  config = {
    environment.etc."greetd/environments".text =
      "sway\n"
      + "$SHELL -l\n";

    services.greetd = {
      enable = true;
      settings = {
        default_session = {
          inherit user;
          command = sway-kiosk "${greet} -l &>/dev/null";
        };
        initial_session = {
          inherit user;
          command = config.greeter.initialSession;
        };
      };
    };
  };
}