From 408750a1518e5a2135ae2ee1b6cc4b7f27e1d83b Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Fri, 27 Dec 2024 17:13:46 +0100 Subject: [PATCH] nixos/services/greetd: add conditional greetd/environments --- config/nixos/services/greetd.nix | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/config/nixos/services/greetd.nix b/config/nixos/services/greetd.nix index 776d69c..25e70da 100644 --- a/config/nixos/services/greetd.nix +++ b/config/nixos/services/greetd.nix @@ -55,16 +55,21 @@ in { greetd.fprintAuth = false; }; - environment.etc."greetd/environments".text = lib.strings.concatStringsSep "\n" [ - ( - lib.optionalString - config.programs.hyprland.enable - ( - if config.programs.hyprland.withUWSM - then "uwsm start -S hyprland-uwsm.desktop" - else "Hyprland" - ) - ) - (lib.optionalString config.programs.sway.enable "sway") - ]; + environment.etc."greetd/environments".text = let + environments = [ + { + name = "Hyprland"; + condition = with config.programs.hyprland; enable && !withUWSM; + } + { + name = "uwsm start -S hyprland-uwsm.desktop"; + condition = with config.programs.hyprland; enable && withUWSM; + } + { + name = "sway"; + condition = config.programs.sway.enable; + } + ]; + in + builtins.concatStringsSep "\n" (map (env: env.name) (builtins.filter (env: env.condition) environments)); }