Autostart nm and syncthing applet on boot

This commit is contained in:
SebastianStork 2024-03-25 19:51:35 +01:00
parent d3ff309fd9
commit af1fe2e180
2 changed files with 75 additions and 4 deletions

View file

@ -1,5 +1,74 @@
{
imports = [
./qtile
config,
pkgs,
lib,
osConfig,
...
}: let
cfg = config.myConfig.dm;
in {
imports = [./qtile];
options.myConfig.dm.tray = {
syncthing.enable = lib.mkEnableOption "";
networkmanager.enable = lib.mkEnableOption "";
};
config = lib.mkMerge [
(lib.mkIf cfg.tray.syncthing.enable {
assertions = [
{
assertion = osConfig.services.syncthing.enable;
message = "Syncthing has to be enabled on the system level.";
}
];
xsession.enable = osConfig.services.xserver.enable;
systemd.user.services = {
syncthingtray = lib.mkIf cfg.tray.syncthing.enable {
Unit = {
Description = "Syncthingtray";
Requires = ["tray.target"];
After = ["graphical-session-pre.target" "tray.target"];
PartOf = ["graphical-session.target"];
};
Service = {
ExecStart = "${pkgs.syncthingtray-minimal}/bin/syncthingtray --wait";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
})
(lib.mkIf cfg.tray.networkmanager.enable {
assertions = [
{
assertion = osConfig.networking.networkmanager.enable;
message = "Networkmanager has to be enabled on the system level.";
}
];
xsession.enable = osConfig.services.xserver.enable;
systemd.user.services = {
nm-applet = lib.mkIf cfg.tray.networkmanager.enable {
Unit = {
Description = "Networkmanager-applet";
Requires = ["tray.target"];
After = ["graphical-session-pre.target" "tray.target"];
PartOf = ["graphical-session.target"];
};
Service = {
ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
})
];
}

View file

@ -1,6 +1,9 @@
{pkgs, ...}: {
myConfig = {
dm.qtile.enable = true;
dm = {
qtile.enable = true;
tray.syncthing.enable = true;
};
vscode.enable = true;
shell = {
bash.enable = true;
@ -45,7 +48,6 @@
hunspellDicts.de_DE
hunspellDicts.en_US
steam
networkmanagerapplet
# Fonts
(nerdfonts.override {fonts = ["JetBrainsMono"];})