nixos-config/modules/greetd/default.nix

114 lines
3.9 KiB
Nix

{ pkgs
, config
, lib
, ...
}:
with lib; let
cfg = config.eboskma.greetd;
style = builtins.replaceStrings [ "{WALLPAPER}" ] [ (builtins.toString ../../home-manager/modules/sway/wallpapers/river-2560.png) ] (builtins.readFile ./greetd.css);
in
{
options.eboskma.greetd = {
enable = mkEnableOption "enable greetd";
sway = mkEnableOption "sway";
};
config =
mkIf cfg.enable
{
services.greetd = {
enable = true;
restart = true;
settings = {
default_session = {
command = "${pkgs.sway}/bin/sway --unsupported-gpu --config /etc/greetd/sway-config";
};
};
};
programs.regreet = {
enable = true;
settings = {
background = {
path = ../../home-manager/modules/sway/wallpapers/river-2560.png;
fit = "Cover";
};
GTK = {
application_prefer_dark_theme = true;
theme_name = "elementary";
cursor_theme = "elementary";
icon_theme_name = "elementary";
font_name = "Iosevka Aile 16";
};
commands = {
reboot = [ "systemctl" "reboot" ];
poweroff = [ "systemctl" "poweroff" ];
};
};
};
security.pam.services.greetd.u2fAuth = false;
environment.systemPackages = with pkgs; [ pantheon.elementary-gtk-theme pantheon.elementary-icon-theme ];
# exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -s /etc/greetd/gtkgreet.css; swaymsg exit"
environment.etc = {
"greetd/sway-config" = {
text = ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "${pkgs.greetd.regreet}/bin/regreet; swaymsg exit"
# bindsym Mod4+shift+f exec swaynag \
# -t warning \
# -m 'What do you want to do?' \
# -b 'Poweroff' 'systemctl poweroff' \
# -b 'Reboot' 'systemctl reboot'
include /etc/sway/config.d/*
'';
user = "greeter";
group = "greeter";
};
"greetd/environments" = {
text = concatStringsSep "\n" ((optional cfg.sway "${pkgs.sway}/bin/sway")
++ [ "${pkgs.bash}/bin/bash" ]);
user = "greeter";
group = "greeter";
};
"greetd/gtkgreet.css" = {
text = style;
user = "greeter";
group = "greeter";
};
"sway/config.d/systemd-env.conf" = {
text = ''
exec_always --no-startup-id systemctl --user import-environment _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK
exec_always --no-startup-id dbus-update-activation-environment --systemd _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK
'';
};
"xdg/gtk-3.0/settings.ini" = {
text = generators.toINI { } {
Settings = {
gtk-theme-name = "elementary";
gtk-icon-theme-name = "elementary";
gtk-cursor-theme-name = "elementary";
gtk-application-prefer-dark-theme = "true";
};
};
};
"xdg/gtk-4.0/settings.ini" = {
text = generators.toINI { } {
Settings = {
gtk-theme-name = "elementary";
gtk-icon-theme-name = "elementary";
gtk-cursor-theme-name = "elementary";
gtk-application-prefer-dark-theme = "true";
};
};
};
};
};
}