153 lines
4.6 KiB
Nix
153 lines
4.6 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib;
|
|
let
|
|
cfg = config.eboskma.greetd;
|
|
steamCfg = config.programs.steam;
|
|
|
|
style = builtins.readFile ./greetd.css;
|
|
|
|
swaySession = pkgs.writeShellScript "sway-session" ''
|
|
${config.programs.sway.package}/bin/sway --unsupported-gpu
|
|
'';
|
|
|
|
steam-gamescope =
|
|
let
|
|
exports = builtins.attrValues (
|
|
builtins.mapAttrs (n: v: "export ${n}=${v}") steamCfg.gamescopeSession.env
|
|
);
|
|
in
|
|
pkgs.writeShellScriptBin "steam-gamescope" ''
|
|
${builtins.concatStringsSep "\n" exports}
|
|
gamescope --steam ${toString steamCfg.gamescopeSession.args} -- steam -tenfoot -pipewire-dmabuf
|
|
'';
|
|
|
|
envVars = concatStringsSep " " (builtins.attrNames config.environment.sessionVariables);
|
|
|
|
moduleStr = moduleType: name: attrs: ''
|
|
${moduleType} "${name}" {
|
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "${name} ${value}") attrs)}
|
|
}
|
|
'';
|
|
|
|
inputStr = moduleStr "input";
|
|
outputStr = moduleStr "output";
|
|
in
|
|
{
|
|
options.eboskma.greetd = {
|
|
enable = mkEnableOption "enable greetd";
|
|
sway = mkEnableOption "sway";
|
|
river = mkEnableOption "river";
|
|
steam = mkEnableOption "steam";
|
|
wayvnc = mkEnableOption "wayvnc";
|
|
output = mkOption {
|
|
description = "An attribute set that defines output modules. See the sway-output(5) manpage for options";
|
|
type = types.attrsOf (types.attrsOf types.str);
|
|
default = { };
|
|
};
|
|
input = mkOption {
|
|
description = "An attribute set that defines input modules. See the sway-input(5) manpage for options";
|
|
type = types.attrsOf (types.attrsOf types.str);
|
|
default = { };
|
|
};
|
|
wallpaper = mkOption {
|
|
description = "Path to an image to use as wallpaper";
|
|
type = types.path;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.greetd = {
|
|
enable = true;
|
|
restart = true;
|
|
settings = {
|
|
default_session = {
|
|
command = "${config.programs.sway.package}/bin/sway --unsupported-gpu --config /etc/greetd/sway-config";
|
|
};
|
|
};
|
|
};
|
|
|
|
security.pam.services.greetd.u2fAuth = false;
|
|
|
|
networking.firewall.allowedTCPPorts = lib.mkIf (cfg.wayvnc && !config.services.tailscale.enable) [
|
|
5900
|
|
];
|
|
|
|
environment = {
|
|
systemPackages = with pkgs; [
|
|
(orchis-theme.override {
|
|
tweaks = [
|
|
"black"
|
|
"compact"
|
|
"macos"
|
|
];
|
|
border-radius = 5;
|
|
})
|
|
catppuccin-cursors.mochaDark
|
|
pantheon.elementary-icon-theme
|
|
];
|
|
etc = {
|
|
"greetd/sway-config" = {
|
|
text = lib.concatStringsSep "\n" (
|
|
(lib.optional cfg.wayvnc "exec ${pkgs.wayvnc}/bin/wayvnc 0.0.0.0")
|
|
++ [
|
|
''
|
|
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -s /etc/greetd/gtkgreet.css -b ${cfg.wallpaper}; swaymsg exit"
|
|
include /etc/sway/config.d/*
|
|
''
|
|
]
|
|
++ (mapAttrsToList inputStr cfg.input)
|
|
++ (mapAttrsToList outputStr cfg.output)
|
|
);
|
|
user = "greeter";
|
|
group = "greeter";
|
|
};
|
|
"greetd/environments" = {
|
|
text = concatStringsSep "\n" (
|
|
(optional cfg.sway "${swaySession}")
|
|
++ (optional cfg.river "${pkgs.river}/bin/river")
|
|
++ (optional cfg.steam "${steam-gamescope}")
|
|
++ [ "${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 ${envVars}
|
|
exec_always --no-startup-id dbus-update-activation-environment --systemd ${envVars}
|
|
'';
|
|
};
|
|
"xdg/gtk-3.0/settings.ini" = {
|
|
text = generators.toINI { } {
|
|
Settings = {
|
|
gtk-theme-name = "Orchis-Dark";
|
|
gtk-icon-theme-name = "elementary";
|
|
gtk-cursor-theme-name = "Catppuccin-Mocha-Dark-Cursors";
|
|
gtk-application-prefer-dark-theme = "true";
|
|
};
|
|
};
|
|
};
|
|
"xdg/gtk-4.0/settings.ini" = {
|
|
text = generators.toINI { } {
|
|
Settings = {
|
|
gtk-theme-name = "Orchis-Dark";
|
|
gtk-icon-theme-name = "elementary";
|
|
gtk-cursor-theme-name = "Catppuccin-Mocha-Dark-Cursors";
|
|
gtk-application-prefer-dark-theme = "true";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|