greetd: refactor: session{Name,Cmd,User} into session attrset

This commit is contained in:
2023-09-02 00:54:05 +00:00
parent 3cc4a1ea19
commit 20aef83496
3 changed files with 14 additions and 12 deletions

View File

@@ -18,6 +18,9 @@ in
}; };
sane.gui.greetd.session.command = mkOption { sane.gui.greetd.session.command = mkOption {
type = types.string; type = types.string;
description = ''
name to use for the default session in syslog.
'';
}; };
sane.gui.greetd.session.name = mkOption { sane.gui.greetd.session.name = mkOption {
default = "greetd-session"; default = "greetd-session";
@@ -51,21 +54,20 @@ in
have sway launch gtkgreet instead of directly presenting a desktop. have sway launch gtkgreet instead of directly presenting a desktop.
''; '';
}; };
# TODO: follow same structure as the options above... sane.gui.greetd.sway.gtkgreet.session.command = mkOption {
sane.gui.greetd.sway.gtkgreet.sessionCmd = mkOption {
type = types.string; type = types.string;
description = '' description = ''
command for gtkgreet to execute on successful authentication. command for gtkgreet to execute on successful authentication.
''; '';
}; };
sane.gui.greetd.sway.gtkgreet.sessionName = mkOption { sane.gui.greetd.sway.gtkgreet.session.name = mkOption {
type = types.string; type = types.string;
description = '' description = ''
name to use for the default session in syslog and in the gtkgreet menu. name to use for the default session in syslog and in the gtkgreet menu.
note that this `sessionName` will become a binary on the user's PATH. note that this `sessionName` will become a binary on the user's PATH.
''; '';
}; };
sane.gui.greetd.sway.gtkgreet.sessionUser = mkOption { sane.gui.greetd.sway.gtkgreet.session.user = mkOption {
type = types.string; type = types.string;
default = "colin"; default = "colin";
description = '' description = ''
@@ -91,14 +93,14 @@ in
}) })
(lib.mkIf cfg.sway.gtkgreet.enable ( (lib.mkIf cfg.sway.gtkgreet.enable (
let let
inherit (cfg.sway.gtkgreet) sessionName sessionCmd sessionUser; inherit (cfg.sway.gtkgreet) session;
sessionProvider = runWithLogger sessionName sessionCmd; sessionProvider = runWithLogger session.name session.command;
in { in {
# gtkgreet shows the --command argument in the UI # gtkgreet shows the --command argument in the UI
# - so we want it to look nice (not a /nix/store/... path) # - so we want it to look nice (not a /nix/store/... path)
# - to do that we put it in the user's PATH. # - to do that we put it in the user's PATH.
sane.gui.greetd.sway.greeterCmd = "${pkgs.greetd.gtkgreet}/bin/gtkgreet --layer-shell --command ${sessionName}"; sane.gui.greetd.sway.greeterCmd = "${pkgs.greetd.gtkgreet}/bin/gtkgreet --layer-shell --command ${session.name}";
users.users.${sessionUser}.packages = [ sessionProvider ]; users.users.${session.user}.packages = [ sessionProvider ];
} }
)) ))

View File

@@ -58,8 +58,8 @@ in
sane.gui.greetd.sway.enable = true; # have greetd launch a sway compositor in which we host a greeter sane.gui.greetd.sway.enable = true; # have greetd launch a sway compositor in which we host a greeter
sane.gui.greetd.sway.gtkgreet = lib.mkIf cfg.useGreeter { sane.gui.greetd.sway.gtkgreet = lib.mkIf cfg.useGreeter {
enable = true; enable = true;
sessionName = "sway-on-gtkgreet"; session.name = "sway-on-gtkgreet";
sessionCmd = "${pkgs.sway}/bin/sway --debug"; session.command = "${pkgs.sway}/bin/sway --debug";
}; };
# unlike other DEs, sway configures no audio stack # unlike other DEs, sway configures no audio stack

View File

@@ -338,8 +338,8 @@ in
enable = true; enable = true;
sway.enable = true; sway.enable = true;
sway.gtkgreet.enable = true; sway.gtkgreet.enable = true;
sway.gtkgreet.sessionName = "sxmo-on-gtkgreet"; sway.gtkgreet.session.name = "sxmo-on-gtkgreet";
sway.gtkgreet.sessionCmd = "${cfg.package}/bin/sxmo_winit.sh"; sway.gtkgreet.session.command = "${cfg.package}/bin/sxmo_winit.sh";
}; };
}) })