nixos/modules/system/gui.nix

47 lines
1.7 KiB
Nix
Raw Permalink 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
};
2024-05-30 15:34:58 +08:00
config = let inherit (inputs.config.nixos.system) gui; in inputs.lib.mkIf gui.enable
{
services =
2023-09-02 21:03:23 +08:00
{
2024-05-30 15:34:58 +08:00
displayManager =
2024-07-31 02:13:24 +08:00
{
sddm = { enable = inputs.lib.mkDefault true; wayland.enable = true; theme = "breeze"; };
defaultSession = "plasma";
};
2024-05-30 15:34:58 +08:00
desktopManager.plasma6.enable = true;
xserver.enable = true;
};
2024-07-31 02:13:24 +08:00
systemd.services.display-manager.enable = inputs.lib.mkDefault gui.autoStart;
2024-05-30 15:34:58 +08:00
environment =
{
sessionVariables =
{
2024-07-09 23:38:30 +08:00
GTK_USE_PORTAL = "1";
NIXOS_OZONE_WL = inputs.lib.mkIf gui.preferred "1";
};
2024-05-30 15:34:58 +08:00
plasma6.excludePackages = inputs.lib.mkIf (!gui.preferred) [ inputs.pkgs.kdePackages.plasma-nm ];
persistence = let inherit (inputs.config.nixos.system) impermanence; in inputs.lib.mkIf impermanence.enable
{
2024-05-30 15:34:58 +08:00
"${impermanence.root}".directories =
[{ directory = "/var/lib/sddm"; user = "sddm"; group = "sddm"; mode = "0700"; }];
};
2023-09-02 21:03:23 +08:00
};
2024-05-30 15:34:58 +08:00
xdg.portal.extraPortals = builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" ];
i18n.inputMethod =
{
2024-07-31 08:40:09 +08:00
enable = true;
type = "fcitx5";
2024-05-30 15:34:58 +08:00
fcitx5.addons = builtins.map (p: inputs.pkgs."fcitx5-${p}")
[ "rime" "chinese-addons" "mozc" "nord" "material-color" ];
};
programs.dconf.enable = true;
};
2023-09-02 21:03:23 +08:00
}