Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos: add BitTorrent Sync service module #1873

Merged
merged 1 commit into from
Mar 21, 2014
Merged

Conversation

thoughtpolice
Copy link
Member

This adds a BitTorrent Sync service module with all the supported configuration options from the JSON configuration file. You can use it through a UI or through the config file to sync specific directories (the two are mutually exclusive).

This module also has one interesting aspect I haven't seen exploited in a NixOS module before: multi-instance systemd units. Note in particular the btsync@ unit.

This allows the administrator to selectively start instances of the btsync service on-demand for a user with their own configuration file. For example, I can have my own config file at /home/a/.config/btsync.conf, and the administrator can start my instance with

$ systemctl start btsync@a

which will start an independent service under my user with my configuration file. For the record, I took this idea from ArchLinux.

I suppose in an ideal world, instead of multi-instance services we would use systemd user services (ref #1689) but as that's not done yet, I find this works adequately. I'm open to other recommendations, however.

description = ''
Shared folder list. If enabled, web UI must be
disabled. Secrets can be generated using <literal>btsync
--generate-secret</literal>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should note that secrets are not very secret in the Nix store.

@shlevy
Copy link
Member

shlevy commented Mar 19, 2014

@thoughtpolice Are you still working on this? Can you address the comments?

@thoughtpolice
Copy link
Member Author

@shlevy Done. This is rebased on top of master with the latest UID changes, and is Ready To Merge.

@thoughtpolice
Copy link
Member Author

This change also addresses all previous comments by @edolstra and @iElectric

@domenkozar
Copy link
Member

Looks good to me

@shlevy
Copy link
Member

shlevy commented Mar 20, 2014

FWIW we already had for example

systemd.services."websockify@" = {
description = "Service to forward websocket connections to TCP connections (from port:to port %I)";
script = ''
IFS=':' read -a array <<< "$1"
${pkgs.pythonPackages.websockify}/bin/websockify --ssl-only \
--cert=${cfg.sslCert} --key=${cfg.sslKey} 0.0.0.0:''${array[0]} 0.0.0.0:''${array[1]}
'';
scriptArgs = "%i";
};
;) But looks good, merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants