Modularize the DE config

This commit is contained in:
SebastianStork 2024-04-16 22:05:20 +02:00
parent 38a5b3cbb1
commit 4b650721b0
11 changed files with 285 additions and 252 deletions

59
modules/home/de/tray.nix Normal file
View file

@ -0,0 +1,59 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.myConfig.de;
in {
options.myConfig.de = {
tray = {
syncthing.enable = lib.mkEnableOption "";
networkmanager.enable = lib.mkEnableOption "";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.tray.syncthing.enable {
home.packages = [pkgs.syncthingtray-minimal];
systemd.user.services = {
syncthingtray = {
Unit = {
Description = "Syncthingtray";
Requires = ["tray.target"];
After = ["graphical-session-pre.target" "tray.target"];
PartOf = ["graphical-session.target"];
};
Service = {
ExecStart = "${lib.getExe' pkgs.syncthingtray-minimal "syncthingtray"} --wait";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
})
(lib.mkIf cfg.tray.networkmanager.enable {
home.packages = [pkgs.networkmanagerapplet];
systemd.user.services = {
nm-applet = {
Unit = {
Description = "Networkmanager-applet";
Requires = ["tray.target"];
After = ["graphical-session-pre.target" "tray.target"];
PartOf = ["graphical-session.target"];
};
Service = {
ExecStart = "${lib.getExe pkgs.networkmanagerapplet}";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
})
];
}