mirror of
https://github.com/CHN-beta/nixos.git
synced 2024-10-23 07:08:45 +08:00
system.gui: fix
This commit is contained in:
parent
e0bec05c59
commit
d77fd05405
@ -6,32 +6,33 @@ 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;
|
services =
|
||||||
inherit (inputs.lib) mkIf;
|
|
||||||
inherit (inputs.config.nixos.system) gui;
|
|
||||||
in mkIf gui.enable
|
|
||||||
{
|
{
|
||||||
services =
|
displayManager =
|
||||||
{
|
{ sddm = { enable = true; wayland.enable = true; theme = "breeze"; }; defaultSession = "plasma"; };
|
||||||
displayManager =
|
desktopManager.plasma6.enable = true;
|
||||||
{ sddm = { enable = true; wayland.enable = true; theme = "breeze"; }; defaultSession = "plasma"; };
|
xserver.enable = true;
|
||||||
desktopManager.plasma6.enable = true;
|
|
||||||
xserver.enable = true;
|
|
||||||
};
|
|
||||||
systemd.services.display-manager.enable = gui.autoStart;
|
|
||||||
environment =
|
|
||||||
{
|
|
||||||
sessionVariables."GTK_USE_PORTAL" = "1";
|
|
||||||
plasma6.excludePackages = inputs.lib.mkIf (!gui.preferred) [ inputs.pkgs.kdePackages.plasma-nm ];
|
|
||||||
};
|
|
||||||
xdg.portal.extraPortals = map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" ];
|
|
||||||
i18n.inputMethod =
|
|
||||||
{
|
|
||||||
enabled = "fcitx5";
|
|
||||||
fcitx5.addons = map (p: inputs.pkgs."fcitx5-${p}") [ "rime" "chinese-addons" "mozc" "nord" "material-color" ];
|
|
||||||
};
|
|
||||||
programs = { dconf.enable = true; };
|
|
||||||
};
|
};
|
||||||
|
systemd.services.display-manager.enable = gui.autoStart;
|
||||||
|
environment =
|
||||||
|
{
|
||||||
|
sessionVariables."GTK_USE_PORTAL" = "1";
|
||||||
|
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 = builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" ];
|
||||||
|
i18n.inputMethod =
|
||||||
|
{
|
||||||
|
enabled = "fcitx5";
|
||||||
|
fcitx5.addons = builtins.map (p: inputs.pkgs."fcitx5-${p}")
|
||||||
|
[ "rime" "chinese-addons" "mozc" "nord" "material-color" ];
|
||||||
|
};
|
||||||
|
programs.dconf.enable = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,68 +7,62 @@ 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;
|
environment.persistence =
|
||||||
inherit (inputs.config.nixos.system) impermanence;
|
|
||||||
in mkIf impermanence.enable
|
|
||||||
{
|
{
|
||||||
environment.persistence =
|
"${impermanence.persistence}" =
|
||||||
{
|
{
|
||||||
"${impermanence.persistence}" =
|
hideMounts = true;
|
||||||
|
directories =
|
||||||
|
[
|
||||||
|
"/var/db"
|
||||||
|
"/var/lib"
|
||||||
|
"/var/log"
|
||||||
|
"/var/spool"
|
||||||
|
"/var/backup"
|
||||||
|
{ directory = "/var/lib/docker/volumes"; mode = "0710"; }
|
||||||
|
"/srv"
|
||||||
|
];
|
||||||
|
files =
|
||||||
|
[
|
||||||
|
"/etc/machine-id"
|
||||||
|
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||||
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||||
|
"/etc/ssh/ssh_host_rsa_key"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"${impermanence.root}" =
|
||||||
|
{
|
||||||
|
hideMounts = true;
|
||||||
|
directories =
|
||||||
|
[
|
||||||
|
"/var/lib/systemd/linger"
|
||||||
|
"/var/lib/systemd/coredump"
|
||||||
|
"/var/lib/systemd/backlight"
|
||||||
|
{ directory = "/var/lib/docker"; mode = "0710"; }
|
||||||
|
"/var/lib/flatpak"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
// (if builtins.elem "chn" inputs.config.nixos.user.users then
|
||||||
|
{
|
||||||
|
users.chn =
|
||||||
{
|
{
|
||||||
hideMounts = true;
|
directories = [ ".cache" ".config/fontconfig" ];
|
||||||
directories =
|
|
||||||
[
|
|
||||||
"/var/db"
|
|
||||||
"/var/lib"
|
|
||||||
"/var/log"
|
|
||||||
"/var/spool"
|
|
||||||
"/var/backup"
|
|
||||||
{ directory = "/var/lib/docker/volumes"; mode = "0710"; }
|
|
||||||
"/srv"
|
|
||||||
];
|
|
||||||
files =
|
|
||||||
[
|
|
||||||
"/etc/machine-id"
|
|
||||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
|
||||||
"/etc/ssh/ssh_host_ed25519_key"
|
|
||||||
"/etc/ssh/ssh_host_rsa_key.pub"
|
|
||||||
"/etc/ssh/ssh_host_rsa_key"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
"${impermanence.root}" =
|
|
||||||
{
|
|
||||||
hideMounts = true;
|
|
||||||
directories =
|
|
||||||
[
|
|
||||||
"/var/lib/systemd/linger"
|
|
||||||
"/var/lib/systemd/coredump"
|
|
||||||
"/var/lib/systemd/backlight"
|
|
||||||
{ directory = "/var/lib/docker"; mode = "0710"; }
|
|
||||||
"/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
|
|
||||||
{
|
|
||||||
users.chn =
|
|
||||||
{
|
|
||||||
directories = [ ".cache" ".config/fontconfig" ];
|
|
||||||
};
|
|
||||||
} else {});
|
|
||||||
"${impermanence.nodatacow}" =
|
|
||||||
{
|
|
||||||
hideMounts = true;
|
|
||||||
directories =
|
|
||||||
[{ directory = "/var/log/journal"; user = "root"; group = "systemd-journal"; mode = "u=rwx,g=rx+s,o=rx"; }]
|
|
||||||
++ (
|
|
||||||
if inputs.config.nixos.virtualization.kvmHost.enable then
|
|
||||||
[{ directory = "/var/lib/libvirt/images"; mode = "0711"; }]
|
|
||||||
else []
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
} else {});
|
||||||
|
"${impermanence.nodatacow}" =
|
||||||
|
{
|
||||||
|
hideMounts = true;
|
||||||
|
directories =
|
||||||
|
[{ directory = "/var/log/journal"; user = "root"; group = "systemd-journal"; mode = "u=rwx,g=rx+s,o=rx"; }]
|
||||||
|
++ (
|
||||||
|
if inputs.config.nixos.virtualization.kvmHost.enable then
|
||||||
|
[{ directory = "/var/lib/libvirt/images"; mode = "0711"; }]
|
||||||
|
else []
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user