home-manager/modules/services/syncthing.nix

35 lines
807 B
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";
2017-07-17 10:10:15 +02:00
};
};
config = mkIf config.services.syncthing.enable {
systemd.user.services.syncthing = {
Unit = {
Description = "Syncthing - Open Source Continuous File Synchronization";
Documentation = "man:syncthing(1)";
After = [ "network.target" ];
};
2017-07-17 10:10:15 +02:00
Service = {
ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
Restart = "on-failure";
SuccessExitStatus = [ 3 4 ];
RestartForceExitStatus = [ 3 4 ];
};
2017-07-17 10:10:15 +02:00
Install = {
WantedBy = [ "default.target" ];
};
2017-07-17 10:10:15 +02:00
};
};
}