2023-09-02 21:03:23 +08:00
|
|
|
inputs:
|
|
|
|
{
|
|
|
|
options.nixos.system.gui = let inherit (inputs.lib) mkOption types; in
|
|
|
|
{
|
2023-12-14 23:28:30 +08:00
|
|
|
enable = mkOption
|
|
|
|
{ type = types.bool; default = builtins.elem "desktop" inputs.config.nixos.packages._packageSets; };
|
|
|
|
preferred = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.enable; };
|
2023-11-12 20:14:33 +08:00
|
|
|
autoStart = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.preferred; };
|
2023-09-02 21:03:23 +08:00
|
|
|
};
|
|
|
|
config =
|
|
|
|
let
|
2023-12-05 15:44:57 +08:00
|
|
|
inherit (builtins) map;
|
2023-09-02 21:03:23 +08:00
|
|
|
inherit (inputs.lib) mkIf;
|
|
|
|
inherit (inputs.config.nixos.system) gui;
|
|
|
|
in mkIf gui.enable
|
|
|
|
{
|
|
|
|
services.xserver =
|
|
|
|
{
|
|
|
|
enable = true;
|
2023-09-05 21:00:23 +08:00
|
|
|
displayManager = { sddm.enable = true; defaultSession = "plasmawayland"; };
|
2023-09-02 21:03:23 +08:00
|
|
|
desktopManager.plasma5.enable = true;
|
|
|
|
videoDrivers = inputs.config.nixos.hardware.gpus;
|
|
|
|
};
|
2023-11-12 20:14:33 +08:00
|
|
|
systemd.services.display-manager = { after = [ "network-online.target" ]; enable = gui.autoStart; };
|
2023-10-18 20:57:58 +08:00
|
|
|
environment =
|
|
|
|
{
|
|
|
|
sessionVariables."GTK_USE_PORTAL" = "1";
|
|
|
|
plasma5.excludePackages = inputs.lib.mkIf (!gui.preferred) [ inputs.pkgs.plasma5Packages.plasma-nm ];
|
|
|
|
};
|
2023-09-02 21:03:23 +08:00
|
|
|
xdg.portal.extraPortals = map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "kde" "wlr" ];
|
|
|
|
i18n.inputMethod =
|
|
|
|
{
|
|
|
|
enabled = "fcitx5";
|
2023-12-05 15:44:57 +08:00
|
|
|
fcitx5.addons = map (p: inputs.pkgs."fcitx5-${p}") [ "rime" "chinese-addons" "mozc" "nord" "material-color" ];
|
2023-09-02 21:03:23 +08:00
|
|
|
};
|
2023-11-16 15:51:47 +08:00
|
|
|
programs = { dconf.enable = true; xwayland.enable = true; };
|
2023-09-02 21:03:23 +08:00
|
|
|
};
|
|
|
|
}
|