system.gui: fix

This commit is contained in:
陈浩南 2024-05-30 15:34:58 +08:00
parent e0bec05c59
commit d77fd05405
2 changed files with 79 additions and 84 deletions

View File

@ -6,12 +6,7 @@ inputs:
preferred = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.enable; }; preferred = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.enable; };
autoStart = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.preferred; }; autoStart = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.preferred; };
}; };
config = config = let inherit (inputs.config.nixos.system) gui; in inputs.lib.mkIf gui.enable
let
inherit (builtins) map;
inherit (inputs.lib) mkIf;
inherit (inputs.config.nixos.system) gui;
in mkIf gui.enable
{ {
services = services =
{ {
@ -25,13 +20,19 @@ inputs:
{ {
sessionVariables."GTK_USE_PORTAL" = "1"; sessionVariables."GTK_USE_PORTAL" = "1";
plasma6.excludePackages = inputs.lib.mkIf (!gui.preferred) [ inputs.pkgs.kdePackages.plasma-nm ]; 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
{
"${impermanence.root}".directories =
[{ directory = "/var/lib/sddm"; user = "sddm"; group = "sddm"; mode = "0700"; }];
}; };
xdg.portal.extraPortals = map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" ]; };
xdg.portal.extraPortals = builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" ];
i18n.inputMethod = i18n.inputMethod =
{ {
enabled = "fcitx5"; enabled = "fcitx5";
fcitx5.addons = map (p: inputs.pkgs."fcitx5-${p}") [ "rime" "chinese-addons" "mozc" "nord" "material-color" ]; fcitx5.addons = builtins.map (p: inputs.pkgs."fcitx5-${p}")
[ "rime" "chinese-addons" "mozc" "nord" "material-color" ];
}; };
programs = { dconf.enable = true; }; programs.dconf.enable = true;
}; };
} }

View File

@ -7,11 +7,7 @@ inputs:
root = mkOption { type = types.nonEmptyStr; default = "/nix/rootfs/current"; }; root = mkOption { type = types.nonEmptyStr; default = "/nix/rootfs/current"; };
nodatacow = mkOption { type = types.nullOr types.nonEmptyStr; default = "/nix/nodatacow"; }; nodatacow = mkOption { type = types.nullOr types.nonEmptyStr; default = "/nix/nodatacow"; };
}; };
config = config = let inherit (inputs.config.nixos.system) impermanence; in inputs.lib.mkIf impermanence.enable
let
inherit (inputs.lib) mkIf;
inherit (inputs.config.nixos.system) impermanence;
in mkIf impermanence.enable
{ {
environment.persistence = environment.persistence =
{ {
@ -47,9 +43,7 @@ inputs:
"/var/lib/systemd/backlight" "/var/lib/systemd/backlight"
{ directory = "/var/lib/docker"; mode = "0710"; } { directory = "/var/lib/docker"; mode = "0710"; }
"/var/lib/flatpak" "/var/lib/flatpak"
] ];
++ (if inputs.config.services.displayManager.sddm.enable then
[{ directory = "/var/lib/sddm"; user = "sddm"; group = "sddm"; mode = "0700"; }] else []);
} }
// (if builtins.elem "chn" inputs.config.nixos.user.users then // (if builtins.elem "chn" inputs.config.nixos.user.users then
{ {