1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 08:09:45 +01:00
home-manager/modules/services/syncthing.nix

69 lines
1.7 KiB
Nix
Raw Normal View History

2017-07-17 10:10:15 +02:00
{ config, lib, pkgs, ... }:
with lib;
{
meta.maintainers = [ maintainers.rycee ];
2017-07-17 10:10:15 +02:00
options = {
services.syncthing = {
enable = mkEnableOption "Syncthing continuous file synchronization";
tray = mkOption {
type = types.bool;
default = false;
description = "Whether to enable QSyncthingTray service.";
};
2017-07-17 10:10:15 +02:00
};
};
config = mkMerge [
(mkIf config.services.syncthing.enable {
systemd.user.services = {
syncthing = {
Unit = {
2020-02-02 00:39:17 +01:00
Description =
"Syncthing - Open Source Continuous File Synchronization";
Documentation = "man:syncthing(1)";
After = [ "network.target" ];
};
2017-07-17 10:10:15 +02:00
Service = {
2020-02-02 00:39:17 +01:00
ExecStart =
"${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
Restart = "on-failure";
SuccessExitStatus = [ 3 4 ];
RestartForceExitStatus = [ 3 4 ];
};
2020-02-02 00:39:17 +01:00
Install = { WantedBy = [ "default.target" ]; };
};
};
})
(mkIf config.services.syncthing.tray {
systemd.user.services = {
qsyncthingtray = {
Unit = {
Description = "QSyncthingTray";
2020-02-02 00:39:17 +01:00
After = [
"graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ];
};
Service = {
2018-07-29 18:15:50 +02:00
Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
};
2017-07-17 10:10:15 +02:00
2020-02-02 00:39:17 +01:00
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
})
];
2017-07-17 10:10:15 +02:00
}