8b77f1db2c
The QSyncthingTray service requires running tray providers such as polybar and taffybar.
70 lines
1.7 KiB
Nix
70 lines
1.7 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
imports = [
|
|
(mkRenamedOptionModule
|
|
[ "services" "qsyncthingtray" "enable" ]
|
|
[ "services" "syncthing" "tray" ])
|
|
];
|
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
options = {
|
|
services.syncthing = {
|
|
enable = mkEnableOption "Syncthing continuous file synchronization";
|
|
|
|
tray = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Whether to enable QSyncthingTray service.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf config.services.syncthing.enable (mkMerge [
|
|
{
|
|
systemd.user.services = {
|
|
syncthing = {
|
|
Unit = {
|
|
Description = "Syncthing - Open Source Continuous File Synchronization";
|
|
Documentation = "man:syncthing(1)";
|
|
After = [ "network.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
|
|
Restart = "on-failure";
|
|
SuccessExitStatus = [ 3 4 ];
|
|
RestartForceExitStatus = [ 3 4 ];
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "default.target" ];
|
|
};
|
|
};
|
|
};
|
|
}
|
|
(mkIf config.services.syncthing.tray {
|
|
systemd.user.services = {
|
|
qsyncthingtray = {
|
|
Unit = {
|
|
Description = "QSyncthingTray";
|
|
After = [ "graphical-session-pre.target" "polybar.service" "taffybar.service" ];
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
};
|
|
})
|
|
]);
|
|
}
|