nixos/modules/system/gui.nix

36 lines
1.3 KiB
Nix
Raw Normal View History

2023-09-02 21:03:23 +08:00
inputs:
{
options.nixos.system.gui = let inherit (inputs.lib) mkOption types; in
{
enable = mkOption { type = types.bool; default = false; };
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; };
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-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
};
}