From 2a145bb8d053b53a3dbac916e54db99b958d2e46 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 6 Apr 2025 21:23:05 +0200 Subject: [PATCH] greetd.nix: fix --- modules/services/greetd.nix | 58 +++++++++++++++---------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/modules/services/greetd.nix b/modules/services/greetd.nix index 0f9ee72..3a01e75 100644 --- a/modules/services/greetd.nix +++ b/modules/services/greetd.nix @@ -3,58 +3,46 @@ lib, pkgs, ... -}: -with lib; let +}: let cfg = config.modules.services.greetd; - inherit (config.modules.other.system) username; - - hyprlandConfig = pkgs.writeText "greetd-hyprland-config" '' - misc { - force_default_wallpaper=0 - focus_on_activate=1 - } - - animations { - enabled=0 - first_launch_animation=0 - } - - workspace=1,default:true,gapsout:0,gapsin:0,border:false,decorate:false - - #exec-once=[workspace 1;fullscreen;noanim] ${ - pkgs.greetd.${cfg.greeter} - }/bin/${cfg.greeter} -l; ${ - pkgs.hyprland - }/bin/hyprctl dispatch exit - #exec-once=${ - pkgs.hyprland - }/bin/hyprctl dispatch focuswindow ${cfg.greeter} - ''; + uwsmEnabled = config.modules.services.uwsm.enable; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) str listOf; + inherit (lib.modules) mkIf; in { options.modules.services.greetd = { enable = mkEnableOption "greetd"; greeter = mkOption { description = "greetd frontend to use"; - type = types.str; + type = str; }; launchOptions = mkOption { description = "/etc/greetd/environments as list of strings"; - type = with types; listOf str; + type = listOf str; + }; + session = mkOption { + description = "Which login session to start"; + type = str; + default = + if uwsmEnabled + then "uwsm start Hyprland" + else "Hyprland"; }; }; config = mkIf cfg.enable { services.greetd = { enable = true; + package = pkgs.greetd; settings.default_session = { - command = "${ - pkgs.hyprland - }/bin/Hyprland --config ${hyprlandConfig}"; - user = username; + command = '' + ${pkgs.greetd.tuigreet}/bin/tuigreet \ + -c '${cfg.session}' \ + -r + -t --time-format "DD.MM.YYYY" + --asteriks''; }; + vt = 1; }; - - environment.etc."greetd/environments".text = - concatStringsSep "\n" cfg.launchOptions; }; }