Files
nixos-config/modules/desktop/sway.nix
2026-02-01 00:42:40 +08:00

66 lines
1.3 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.my.desktop.sway;
utilitiesPkgs =
if cfg.utilities == "minimal" then
[ ]
else if cfg.utilities == "essentials" then
with pkgs; [
wl-clipboard
grim
]
else if cfg.utilities == "full" then
with pkgs; [
wl-clipboard
grim
slurp
swaylock
swayidle
waybar
mako # notifications
wofi # launcher
brightnessctl
playerctl
pavucontrol
]
else
[ ];
portalPkgs = with pkgs; [ xdg-desktop-portal-gtk ];
in
{
options.my.desktop.sway = {
utilities = lib.mkOption {
type = lib.types.enum [ "minimal" "essentials" "full" ];
default = "essentials";
description = "Utility bundle size for a Sway environment.";
};
x11Compatibility = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable XWayland support for X11-only applications.";
};
};
config = lib.mkMerge [
{
programs.sway = {
enable = true;
xwayland.enable = cfg.x11Compatibility;
};
services.seatd.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = portalPkgs;
};
environment.systemPackages = utilitiesPkgs;
}
];
}