2023-09-02 21:03:23 +08:00
|
|
|
inputs:
|
|
|
|
{
|
|
|
|
options.nixos.system.gui = let inherit (inputs.lib) mkOption types; in
|
|
|
|
{
|
2024-04-25 17:55:57 +08:00
|
|
|
enable = mkOption { type = types.bool; default = false; };
|
2023-12-14 23:28:30 +08:00
|
|
|
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
|
|
|
|
{
|
2024-05-21 14:15:47 +08:00
|
|
|
services =
|
2023-09-02 21:03:23 +08:00
|
|
|
{
|
2024-05-21 14:15:47 +08:00
|
|
|
displayManager = { sddm.enable = true; defaultSession = "plasmawayland"; };
|
|
|
|
xserver = { enable = true; desktopManager.plasma6.enable = true; };
|
2023-09-02 21:03:23 +08:00
|
|
|
};
|
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";
|
2024-05-21 13:02:25 +08:00
|
|
|
plasma6.excludePackages = inputs.lib.mkIf (!gui.preferred) [ inputs.pkgs.kdePackages.plasma-nm ];
|
2023-10-18 20:57:58 +08:00
|
|
|
};
|
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
|
|
|
};
|
|
|
|
}
|