2024-02-05 11:46:52 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2022-03-01 22:19:03 +01:00
|
|
|
}:
|
2024-02-05 11:46:52 +01:00
|
|
|
with lib;
|
|
|
|
let
|
2022-03-01 22:19:03 +01:00
|
|
|
cfg = config.eboskma.greetd;
|
2023-09-29 11:52:45 +02:00
|
|
|
steamCfg = config.programs.steam;
|
2022-07-03 22:43:40 +02:00
|
|
|
|
2023-09-29 11:52:45 +02:00
|
|
|
style = builtins.readFile ./greetd.css;
|
2022-10-30 22:19:50 +01:00
|
|
|
|
2023-09-29 11:52:45 +02:00
|
|
|
swaySession = pkgs.writeShellScript "sway-session" ''
|
2024-03-26 15:06:20 +01:00
|
|
|
${config.programs.sway.package}/bin/sway --unsupported-gpu
|
2023-09-29 11:52:45 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
steam-gamescope =
|
|
|
|
let
|
2024-02-05 11:46:52 +01:00
|
|
|
exports = builtins.attrValues (
|
|
|
|
builtins.mapAttrs (n: v: "export ${n}=${v}") steamCfg.gamescopeSession.env
|
|
|
|
);
|
2023-09-29 11:52:45 +02:00
|
|
|
in
|
|
|
|
pkgs.writeShellScriptBin "steam-gamescope" ''
|
|
|
|
${builtins.concatStringsSep "\n" exports}
|
|
|
|
gamescope --steam ${toString steamCfg.gamescopeSession.args} -- steam -tenfoot -pipewire-dmabuf
|
|
|
|
'';
|
2023-10-05 14:57:57 +02:00
|
|
|
|
|
|
|
envVars = concatStringsSep " " (builtins.attrNames config.environment.sessionVariables);
|
2023-11-30 11:50:10 +01:00
|
|
|
|
|
|
|
moduleStr = moduleType: name: attrs: ''
|
|
|
|
${moduleType} "${name}" {
|
|
|
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "${name} ${value}") attrs)}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
inputStr = moduleStr "input";
|
|
|
|
outputStr = moduleStr "output";
|
2022-04-27 00:21:19 +02:00
|
|
|
in
|
|
|
|
{
|
2021-11-17 16:32:18 +01:00
|
|
|
options.eboskma.greetd = {
|
|
|
|
enable = mkEnableOption "enable greetd";
|
2022-11-19 20:00:54 +01:00
|
|
|
sway = mkEnableOption "sway";
|
2024-04-22 17:42:31 +02:00
|
|
|
river = mkEnableOption "river";
|
2023-09-29 11:52:45 +02:00
|
|
|
steam = mkEnableOption "steam";
|
|
|
|
wayvnc = mkEnableOption "wayvnc";
|
2023-11-30 11:50:10 +01:00
|
|
|
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 = { };
|
|
|
|
};
|
2023-10-05 14:57:57 +02:00
|
|
|
wallpaper = mkOption {
|
|
|
|
description = "Path to an image to use as wallpaper";
|
|
|
|
type = types.path;
|
|
|
|
};
|
2021-11-17 16:32:18 +01:00
|
|
|
};
|
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.greetd = {
|
|
|
|
enable = true;
|
|
|
|
restart = true;
|
|
|
|
settings = {
|
|
|
|
default_session = {
|
2024-04-05 13:15:40 +02:00
|
|
|
command = "${config.programs.sway.package}/bin/sway --unsupported-gpu --config /etc/greetd/sway-config";
|
2021-11-17 16:32:18 +01:00
|
|
|
};
|
2024-02-05 11:46:52 +01:00
|
|
|
};
|
|
|
|
};
|
2023-09-13 23:57:47 +02:00
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
security.pam.services.greetd.u2fAuth = false;
|
2023-09-13 23:57:47 +02:00
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
networking.firewall.allowedTCPPorts = lib.mkIf (cfg.wayvnc && !config.services.tailscale.enable) [
|
|
|
|
5900
|
|
|
|
];
|
2023-09-29 11:52:45 +02:00
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
environment = {
|
|
|
|
systemPackages = with pkgs; [
|
2024-06-08 16:02:42 +02:00
|
|
|
(orchis-theme.override {
|
|
|
|
tweaks = [
|
|
|
|
"black"
|
|
|
|
"compact"
|
|
|
|
"macos"
|
|
|
|
];
|
|
|
|
border-radius = 5;
|
|
|
|
})
|
|
|
|
catppuccin-cursors.mochaDark
|
2024-02-05 11:46:52 +01:00
|
|
|
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}")
|
2024-04-22 17:42:31 +02:00
|
|
|
++ (optional cfg.river "${pkgs.river}/bin/river")
|
2024-02-05 11:46:52 +01:00
|
|
|
++ (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 = {
|
2024-06-08 16:02:42 +02:00
|
|
|
gtk-theme-name = "Orchis-Dark";
|
2024-02-05 11:46:52 +01:00
|
|
|
gtk-icon-theme-name = "elementary";
|
2024-06-08 16:02:42 +02:00
|
|
|
gtk-cursor-theme-name = "Catppuccin-Mocha-Dark-Cursors";
|
2024-02-05 11:46:52 +01:00
|
|
|
gtk-application-prefer-dark-theme = "true";
|
2023-09-06 17:01:26 +02:00
|
|
|
};
|
2024-02-05 11:46:52 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
"xdg/gtk-4.0/settings.ini" = {
|
|
|
|
text = generators.toINI { } {
|
|
|
|
Settings = {
|
2024-06-08 16:02:42 +02:00
|
|
|
gtk-theme-name = "Orchis-Dark";
|
2024-02-05 11:46:52 +01:00
|
|
|
gtk-icon-theme-name = "elementary";
|
2024-06-08 16:02:42 +02:00
|
|
|
gtk-cursor-theme-name = "Catppuccin-Mocha-Dark-Cursors";
|
2024-02-05 11:46:52 +01:00
|
|
|
gtk-application-prefer-dark-theme = "true";
|
2022-03-18 21:14:51 +01:00
|
|
|
};
|
2022-01-03 13:03:10 +01:00
|
|
|
};
|
|
|
|
};
|
2021-11-17 16:32:18 +01:00
|
|
|
};
|
2024-02-05 11:46:52 +01:00
|
|
|
};
|
|
|
|
};
|
2021-11-17 16:32:18 +01:00
|
|
|
}
|