fixed syncthing service to work as expected

This commit is contained in:
Enrico Fasoli 2015-08-27 14:01:10 +00:00 committed by Rok Garbas
parent 7182ef35f4
commit 44788bb2ce

View File

@ -36,9 +36,7 @@ in
dataDir = mkOption { dataDir = mkOption {
default = "/var/lib/syncthing"; default = "/var/lib/syncthing";
description = '' description = ''
Path where the `.syncthing` (settings and keys) and `Sync` Path where the settings and keys will exist.
(your synced files) directories will exist. This can be your home
directory.
''; '';
}; };
@ -57,18 +55,12 @@ in
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment.STNORESTART = "placeholder"; # do not self-restart environment.STNORESTART = "placeholder"; # do not self-restart
environment.HOME = "${cfg.dataDir}";
serviceConfig = { serviceConfig = {
User = "${cfg.user}"; User = "${cfg.user}";
PermissionsStartOnly = true; PermissionsStartOnly = true;
Restart = "always"; Restart = "always";
ExecStart = "${pkgs.syncthing}/bin/syncthing -home=${cfg.dataDir}/.syncthing"; ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -home=${cfg.dataDir}";
}; };
preStart = ''
mkdir -p ${cfg.dataDir}
chown ${cfg.user} ${cfg.dataDir}
'';
}; };
environment.systemPackages = [ pkgs.syncthing ]; environment.systemPackages = [ pkgs.syncthing ];