Compare commits

..

No commits in common. "d97f024b9a22987558fdb100cc5588eca3b7a903" and "197b557468a5a8d65cdd5aff198745336b4341ff" have entirely different histories.

3 changed files with 15 additions and 42 deletions

View File

@ -65,7 +65,7 @@
}; };
}; };
services.greetd.settings.initial_session = { services.greetd.settings.initial_session = {
command = config.nixfiles.programs.greetd.settings.finalCommand; command = config.nixfiles.programs.greetd.settings.command;
user = "nullbite"; user = "nullbite";
}; };

View File

@ -1,22 +1,16 @@
{ pkgs, config, lib, options, ... }: { pkgs, config, lib, options, ... }:
let let
cfg = config.nixfiles.programs.greetd; cfg = config.nixfiles.programs.greetd;
inherit (lib.types) bool enum nullOr str path listOf; inherit (lib.types) bool enum nullOr str path;
inherit (builtins) isNull; inherit (builtins) isNull;
inherit (lib) optional optionals; inherit (lib) optional optionals;
optionalsSet = val: optionals (!(isNull val)); optionalsSet = val: optionals (!(isNull val));
optionalSet = val: optional (!(isNull val));
sessions = config.services.xserver.displayManager.sessionData.desktops; sessions = config.services.xserver.displayManager.sessionData.desktops;
xsessions = "${sessions}/share/xsessions"; xsessions = "${sessions}/share/xsessions";
wayland-sessions = "${sessions}/share/wayland-sessions"; wayland-sessions = "${sessions}/share/wayland-sessions";
loginwrap=pkgs.writeShellScriptBin "loginwrap" ''
exec "$SHELL" -lc 'exec "$@"' "login-wrapper" "$@"
'';
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ loginwrap ];
services.greetd = { services.greetd = {
enable = true; enable = true;
settings = { settings = {
@ -30,10 +24,7 @@ in
"--sessions" "${xsessions}:${wayland-sessions}" ] "--sessions" "${xsessions}:${wayland-sessions}" ]
++ optionalsSet st.greeting [ "--greeting" st.greeting ] ++ optionalsSet st.greeting [ "--greeting" st.greeting ]
++ optional st.time "--time" ++ optional st.time "--time"
++ optionalsSet st.command [ "--cmd" st.finalCommand ] ++ optionalsSet st.command [ "--cmd" (lib.escapeShellArg st.command) ];
# i think tuigreet might be outdated on nix. disable this because it's not a valid option
# ++ optionalsSet st.loginShell [ "--session-wrapper" "loginwrap" ]
;
in lib.escapeShellArgs args; in lib.escapeShellArgs args;
}) })
@ -59,29 +50,11 @@ in
default = "log in pwease!! uwu"; default = "log in pwease!! uwu";
example = "something boring"; example = "something boring";
}; };
finalCommand = lib.mkOption {
description = "Final version of command";
type = nullOr str;
default = let
st = cfg.settings;
prevcmd = st.command;
command-login-wrapped = [ "loginwrap" ] ++ prevcmd;
cmd = if (builtins.isNull prevcmd) then null else
(if st.loginShell then command-login-wrapped else prevcmd);
in lib.escapeShellArgs cmd;
readOnly = true;
};
command = lib.mkOption { command = lib.mkOption {
description = "Command to run following successful authentication"; description = "Command to run following successful authentication";
type = nullOr (listOf str); type = nullOr str;
default = null; default = null;
example = [ "Hyprland" ]; example = "Hyprland";
};
loginShell = lib.mkOption {
description = "Wrap in login shell to source .profile/.zshenv/etc. (if configurable).";
type = bool;
default = true;
example = false;
}; };
time = lib.mkOption { time = lib.mkOption {
description = "Whether to show the current time (if configurable)"; description = "Whether to show the current time (if configurable)";

View File

@ -27,7 +27,7 @@ in
nixfiles.programs.greetd = { nixfiles.programs.greetd = {
enable = true; enable = true;
settings = { settings = {
command = [ "${pkgs.hyprland}/bin/Hyprland" ]; command = "${pkgs.hyprland}/bin/Hyprland";
}; };
}; };