nixos: btsync - switch to using systemd user services

Signed-off-by: Austin Seipp <aseipp@pobox.com>
This commit is contained in:
Austin Seipp 2016-01-07 00:10:05 -06:00
parent 90b853b706
commit 4dc7cab40e

View File

@ -83,15 +83,13 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
If enabled, start the Bittorrent Sync daemon. Once enabled, If enabled, start the Bittorrent Sync daemon. Once enabled, you can
you can interact with the service through the Web UI, or interact with the service through the Web UI, or configure it in your
configure it in your NixOS configuration. Enabling the NixOS configuration. Enabling the <literal>btsync</literal> service
<literal>btsync</literal> service also installs a also installs a systemd user unit which can be used to start
multi-instance systemd unit which can be used to start user-specific copies of the daemon. Once installed, you can use
user-specific copies of the daemon. Once installed, you can <literal>systemctl --user start btsync</literal> as your user to start
use <literal>systemctl start btsync@user</literal> to start the daemon using the configuration file located at
the daemon only for user <literal>user</literal>, using the
configuration file located at
<literal>$HOME/.config/btsync.conf</literal>. <literal>$HOME/.config/btsync.conf</literal>.
''; '';
}; };
@ -212,7 +210,9 @@ in
default = "/var/lib/btsync/"; default = "/var/lib/btsync/";
example = "/var/lib/btsync/"; example = "/var/lib/btsync/";
description = '' description = ''
Where to store the bittorrent sync files. Where BitTorrent Sync will store it's database files (containing
things like username info and licenses). Generally, you should not
need to ever change this.
''; '';
}; };
@ -311,12 +311,11 @@ in
}; };
}; };
systemd.services."btsync@" = with pkgs; { systemd.user.services.btsync = with pkgs; {
description = "Bittorrent Sync Service for %i"; description = "Bittorrent Sync user service";
after = [ "network.target" "local-fs.target" ]; after = [ "network.target" "local-fs.target" ];
serviceConfig = { serviceConfig = {
Restart = "on-abort"; Restart = "on-abort";
User = "%i";
ExecStart = ExecStart =
"${bittorrentSync}/bin/btsync --nodaemon --config %h/.config/btsync.conf"; "${bittorrentSync}/bin/btsync --nodaemon --config %h/.config/btsync.conf";
}; };