nichts/modules/services/greetd.nix

62 lines
1.4 KiB
Nix
Raw Normal View History

2024-05-22 14:29:45 +02:00
{
config,
2024-07-21 21:58:18 +02:00
inputs',
2024-05-22 14:29:45 +02:00
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.services.greetd;
inherit (config.modules.other.system) username;
2024-05-05 20:28:17 +02:00
hyprlandConfig = pkgs.writeText "greetd-hyprland-config" ''
misc {
force_default_wallpaper=0
focus_on_activate=1
}
2024-05-05 20:28:17 +02:00
animations {
enabled=0
first_launch_animation=0
}
2024-05-05 20:28:17 +02:00
workspace=1,default:true,gapsout:0,gapsin:0,border:false,decorate:false
2024-05-05 20:28:17 +02:00
#exec-once=[workspace 1;fullscreen;noanim] ${
pkgs.greetd.${cfg.greeter}
}/bin/${cfg.greeter} -l; ${
2024-07-21 21:58:18 +02:00
inputs'.hyprland.packages.hyprland
}/bin/hyprctl dispatch exit
#exec-once=${
2024-07-21 21:58:18 +02:00
inputs'.hyprland.packages.hyprland
}/bin/hyprctl dispatch focuswindow ${cfg.greeter}
'';
2024-05-05 20:28:17 +02:00
in {
options.modules.services.greetd = {
enable = mkEnableOption "greetd";
greeter = mkOption {
description = "greetd frontend to use";
type = types.str;
2024-05-05 20:28:17 +02:00
};
launchOptions = mkOption {
description = "/etc/greetd/environments as list of strings";
type = with types; listOf str;
};
};
2024-05-05 20:28:17 +02:00
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings.default_session = {
command = "${
2024-07-21 21:58:18 +02:00
inputs'.hyprland.packages.hyprland
2024-05-22 14:29:45 +02:00
}/bin/Hyprland --config ${hyprlandConfig}";
user = username;
};
2024-05-05 20:28:17 +02:00
};
environment.etc."greetd/environments".text =
concatStringsSep "\n" cfg.launchOptions;
};
2024-05-05 20:28:17 +02:00
}