2023-11-22 15:33:16 -05:00
|
|
|
{
|
2024-02-06 12:59:55 -05:00
|
|
|
ags,
|
|
|
|
config,
|
2023-11-22 15:33:16 -05:00
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
2024-01-22 11:09:37 -05:00
|
|
|
}: let
|
2024-02-05 12:00:25 -05:00
|
|
|
inherit (lib) optionals readFile;
|
2024-01-09 13:13:04 -05:00
|
|
|
inherit (config.vars) mainUser greetdDupe mainMonitor;
|
|
|
|
|
2023-11-25 19:24:33 -05:00
|
|
|
# Nix stuff
|
2023-11-25 17:13:46 -05:00
|
|
|
isNvidia = config.hardware.nvidia.modesetting.enable;
|
2023-12-04 01:13:24 -05:00
|
|
|
isTouchscreen = config.hardware.sensor.iio.enable;
|
2023-11-25 03:24:12 -05:00
|
|
|
|
2024-02-05 22:46:43 -05:00
|
|
|
hyprland = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
2023-10-19 19:36:47 -04:00
|
|
|
|
2023-11-25 19:24:33 -05:00
|
|
|
# Show Regreet on all monitors
|
2024-02-05 22:46:43 -05:00
|
|
|
dupeMonitors = pkgs.writeShellApplication {
|
|
|
|
name = "dupeMonitors";
|
|
|
|
runtimeInputs = [hyprland pkgs.jq];
|
|
|
|
text = ''
|
|
|
|
main="${mainMonitor}"
|
|
|
|
names="($(hyprctl -j monitors | jq -r '.[] .description'))"
|
|
|
|
|
|
|
|
if [[ "$main" == "null" ]]; then
|
|
|
|
main="''${names[0]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for (( i=0; i<''${#names[@]}; i++ )); do
|
|
|
|
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
name=$(echo "''${names[$i]}" | sed 's/.*(\(.*\))/\1/')
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
desc=$(echo "''${names[$i]}" | sed 's/ (.*//')
|
|
|
|
|
|
|
|
if [[ "$name" != "$main" && "desc:$desc" != "$main" ]]; then
|
|
|
|
hyprctl keyword monitor "$name",preferred,auto,1,mirror,"$main"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
2023-10-19 19:36:47 -04:00
|
|
|
|
2024-02-05 12:00:25 -05:00
|
|
|
# Check if user wants the greeter only on main monitor
|
2023-12-01 14:12:33 -05:00
|
|
|
setupMonitors =
|
2024-01-09 13:13:04 -05:00
|
|
|
if (mainMonitor != "null" && !greetdDupe)
|
2024-02-05 22:46:43 -05:00
|
|
|
then "hyprctl dispatch focusmonitor ${mainMonitor}"
|
|
|
|
else "dupeMonitors";
|
2023-11-25 19:24:33 -05:00
|
|
|
|
2024-02-05 12:00:25 -05:00
|
|
|
# Setup Hyprland as the greeter's compositor
|
2023-11-25 17:13:46 -05:00
|
|
|
hyprConf =
|
|
|
|
pkgs.writeText "greetd-hypr-config"
|
|
|
|
(lib.strings.concatStrings ((optionals isNvidia [
|
|
|
|
"env = LIBVA_DRIVER_NAME,nvidia\n"
|
|
|
|
"env = XDG_SESSION_TYPE,wayland\n"
|
|
|
|
"env = GBM_BACKEND,nvidia-drm\n"
|
|
|
|
"env = __GLX_VENDOR_LIBRARY_NAME,nvidia\n"
|
|
|
|
"env = WLR_NO_HARDWARE_CURSORS,1\n"
|
|
|
|
])
|
|
|
|
++ [
|
2024-02-06 12:59:55 -05:00
|
|
|
"exec-once = ${setupMonitors} && sleep 0.5 &&"
|
|
|
|
# FIXME: doesn't start
|
2024-02-05 12:00:25 -05:00
|
|
|
" swww init --no-cache &&"
|
2023-11-25 17:13:46 -05:00
|
|
|
" swww img -t none ${pkgs.dracula-theme}/wallpapers/waves.png\n"
|
2023-11-23 01:08:59 -05:00
|
|
|
|
2023-12-27 11:39:38 -05:00
|
|
|
"${readFile ./hyprland.conf}\n"
|
2023-10-19 17:05:13 -04:00
|
|
|
|
2024-02-06 12:59:55 -05:00
|
|
|
"exec-once = ags -b greeter &> /tmp/ags.log; hyprctl dispatch exit"
|
2023-11-25 17:13:46 -05:00
|
|
|
]));
|
2023-10-19 17:05:13 -04:00
|
|
|
in {
|
2024-02-05 12:00:25 -05:00
|
|
|
# Add home folder for home-manager to work
|
2024-02-05 16:21:19 -05:00
|
|
|
users.users.greeter = {
|
|
|
|
home = "/var/lib/greeter";
|
|
|
|
createHome = true;
|
|
|
|
};
|
2024-02-05 12:00:25 -05:00
|
|
|
|
|
|
|
home-manager.users.greeter = {
|
|
|
|
imports = [
|
2024-02-06 12:59:55 -05:00
|
|
|
ags.homeManagerModules.default
|
2024-02-05 12:00:25 -05:00
|
|
|
../../common/vars
|
|
|
|
../../home/theme.nix
|
|
|
|
];
|
2023-12-08 14:21:23 -05:00
|
|
|
|
2024-02-06 12:59:55 -05:00
|
|
|
programs.ags.enable = true;
|
|
|
|
|
2024-02-05 22:46:43 -05:00
|
|
|
home = {
|
|
|
|
packages = [
|
|
|
|
hyprland
|
|
|
|
dupeMonitors
|
|
|
|
pkgs.bun
|
|
|
|
pkgs.sassc
|
|
|
|
pkgs.swww
|
|
|
|
pkgs.gtk3
|
|
|
|
pkgs.glib
|
|
|
|
];
|
|
|
|
|
|
|
|
file = {
|
|
|
|
".config/ags" = {
|
|
|
|
source = ../ags/config;
|
|
|
|
recursive = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
".config/ags/config.js".text =
|
|
|
|
/*
|
|
|
|
javascript
|
|
|
|
*/
|
|
|
|
''
|
|
|
|
import { transpileTypeScript } from './js/utils.js';
|
|
|
|
|
|
|
|
export default (await transpileTypeScript('greeter')).default;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-10-19 17:05:13 -04:00
|
|
|
|
2024-02-05 12:00:25 -05:00
|
|
|
vars = config.vars;
|
|
|
|
home.stateVersion = "24.05";
|
2023-10-19 17:05:13 -04:00
|
|
|
};
|
|
|
|
|
2023-12-04 01:13:24 -05:00
|
|
|
services = {
|
|
|
|
xserver = {
|
|
|
|
displayManager = {
|
|
|
|
sessionPackages = [hyprland];
|
|
|
|
};
|
|
|
|
|
|
|
|
libinput.enable = true;
|
|
|
|
wacom.enable = isTouchscreen;
|
|
|
|
};
|
|
|
|
|
|
|
|
greetd = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
default_session = {
|
2024-02-05 22:46:43 -05:00
|
|
|
command = "Hyprland --config ${hyprConf}";
|
2023-12-04 01:13:24 -05:00
|
|
|
user = "greeter";
|
|
|
|
};
|
|
|
|
|
|
|
|
initial_session = {
|
2024-02-05 22:46:43 -05:00
|
|
|
command = "Hyprland";
|
2024-01-09 13:13:04 -05:00
|
|
|
user = mainUser;
|
2023-12-04 01:13:24 -05:00
|
|
|
};
|
2023-10-19 17:05:13 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# unlock GPG keyring on login
|
|
|
|
services.gnome.gnome-keyring.enable = true;
|
|
|
|
security.pam.services.greetd.enableGnomeKeyring = true;
|
|
|
|
}
|