Merge pull request #62529 from danieldk/remove-btsync-module

nixos/btsync: remove
This commit is contained in:
Jörg Thalheim 2019-06-03 13:21:58 +01:00 committed by GitHub
commit e8e1dc71c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 390 deletions

View File

@ -112,6 +112,18 @@
</link>
</para>
</listitem>
<listitem>
<para>
Since Bittorrent Sync was superseded by Resilio Sync in 2016, the
<literal>bittorrentSync</literal>, <literal>bittorrentSync14</literal>,
and <literal>bittorrentSync16</literal> packages have been removed in
favor of <literal>resilio-sync</literal>.
</para>
<para>
The corresponding module, <option>services.btsync</option> has been
replaced by the <option>services.resilio</option> module.
</para>
</listitem>
<listitem>
<para>
The limesurvey apache subservice was replaced with a full NixOS module.

View File

@ -145,7 +145,7 @@
#notbit = 111; # unused
aerospike = 111;
ngircd = 112;
btsync = 113;
#btsync = 113; # unused
minecraft = 114;
vault = 115;
rippled = 116;
@ -457,7 +457,7 @@
#notbit = 111; # unused
aerospike = 111;
#ngircd = 112; # unused
btsync = 113;
#btsync = 113; # unused
#minecraft = 114; # unused
vault = 115;
#ripped = 116; # unused

View File

@ -541,7 +541,6 @@
./services/networking/autossh.nix
./services/networking/bird.nix
./services/networking/bitlbee.nix
./services/networking/btsync.nix
./services/networking/charybdis.nix
./services/networking/chrony.nix
./services/networking/cjdns.nix

View File

@ -1,324 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.btsync;
bittorrentSync = cfg.package;
listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort);
optionalEmptyStr = b: v: optionalString (b != "") v;
webUIConfig = optionalString cfg.enableWebUI
''
"webui":
{
${optionalEmptyStr cfg.httpLogin "\"login\": \"${cfg.httpLogin}\","}
${optionalEmptyStr cfg.httpPass "\"password\": \"${cfg.httpPass}\","}
${optionalEmptyStr cfg.apiKey "\"api_key\": \"${cfg.apiKey}\","}
${optionalEmptyStr cfg.directoryRoot "\"directory_root\": \"${cfg.directoryRoot}\","}
"listen": "${listenAddr}"
}
'';
knownHosts = e:
optionalString (e ? "knownHosts")
(concatStringsSep "," (map (v: "\"${v}\"") e."knownHosts"));
sharedFoldersRecord =
concatStringsSep "," (map (entry:
let helper = attr: v:
if (entry ? attr) then boolToString entry.attr else boolToString v;
in
''
{
"secret": "${entry.secret}",
"dir": "${entry.directory}",
"use_relay_server": ${helper "useRelayServer" true},
"use_tracker": ${helper "useTracker" true},
"use_dht": ${helper "useDHT" false},
"search_lan": ${helper "searchLAN" true},
"use_sync_trash": ${helper "useSyncTrash" true},
"known_hosts": [${knownHosts entry}]
}
'') cfg.sharedFolders);
sharedFoldersConfig = optionalString (cfg.sharedFolders != [])
''
"shared_folders":
[
${sharedFoldersRecord}
]
'';
configFile = pkgs.writeText "btsync.config"
''
{
"device_name": "${cfg.deviceName}",
"storage_path": "${cfg.storagePath}",
"listening_port": ${toString cfg.listeningPort},
"use_gui": false,
"check_for_updates": ${boolToString cfg.checkForUpdates},
"use_upnp": ${boolToString cfg.useUpnp},
"download_limit": ${toString cfg.downloadLimit},
"upload_limit": ${toString cfg.uploadLimit},
"lan_encrypt_data": ${boolToString cfg.encryptLAN},
${webUIConfig}
${sharedFoldersConfig}
}
'';
in
{
options = {
services.btsync = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
If enabled, start the Bittorrent Sync daemon. Once enabled, you can
interact with the service through the Web UI, or configure it in your
NixOS configuration. Enabling the <literal>btsync</literal> service
also installs a systemd user unit which can be used to start
user-specific copies of the daemon. Once installed, you can use
<literal>systemctl --user start btsync</literal> as your user to start
the daemon using the configuration file located at
<literal>$HOME/.config/btsync.conf</literal>.
'';
};
deviceName = mkOption {
type = types.str;
example = "Voltron";
description = ''
Name of the Bittorrent Sync device.
'';
};
listeningPort = mkOption {
type = types.int;
default = 0;
example = 44444;
description = ''
Listening port. Defaults to 0 which randomizes the port.
'';
};
checkForUpdates = mkOption {
type = types.bool;
default = true;
description = ''
Determines whether to check for updates and alert the user
about them in the UI.
'';
};
useUpnp = mkOption {
type = types.bool;
default = true;
description = ''
Use Universal Plug-n-Play (UPnP)
'';
};
downloadLimit = mkOption {
type = types.int;
default = 0;
example = 1024;
description = ''
Download speed limit. 0 is unlimited (default).
'';
};
uploadLimit = mkOption {
type = types.int;
default = 0;
example = 1024;
description = ''
Upload speed limit. 0 is unlimited (default).
'';
};
httpListenAddr = mkOption {
type = types.str;
default = "0.0.0.0";
example = "1.2.3.4";
description = ''
HTTP address to bind to.
'';
};
httpListenPort = mkOption {
type = types.int;
default = 9000;
description = ''
HTTP port to bind on.
'';
};
httpLogin = mkOption {
type = types.str;
example = "allyourbase";
default = "";
description = ''
HTTP web login username.
'';
};
httpPass = mkOption {
type = types.str;
example = "arebelongtous";
default = "";
description = ''
HTTP web login password.
'';
};
encryptLAN = mkOption {
type = types.bool;
default = true;
description = "Encrypt LAN data.";
};
enableWebUI = mkOption {
type = types.bool;
default = false;
description = ''
Enable Web UI for administration. Bound to the specified
<literal>httpListenAddress</literal> and
<literal>httpListenPort</literal>.
'';
};
package = mkOption {
type = types.package;
example = literalExample "pkgs.bittorrentSync20";
description = ''
Branch of bittorrent sync to use.
'';
};
storagePath = mkOption {
type = types.path;
default = "/var/lib/btsync/";
description = ''
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.
'';
};
apiKey = mkOption {
type = types.str;
default = "";
description = "API key, which enables the developer API.";
};
directoryRoot = mkOption {
type = types.str;
default = "";
example = "/media";
description = "Default directory to add folders in the web UI.";
};
sharedFolders = mkOption {
default = [];
example =
[ { secret = "AHMYFPCQAHBM7LQPFXQ7WV6Y42IGUXJ5Y";
directory = "/home/user/sync_test";
useRelayServer = true;
useTracker = true;
useDHT = false;
searchLAN = true;
useSyncTrash = true;
knownHosts =
[ "192.168.1.2:4444"
"192.168.1.3:4444"
];
}
];
description = ''
Shared folder list. If enabled, web UI must be
disabled. Secrets can be generated using <literal>btsync
--generate-secret</literal>. Note that this secret will be
put inside the Nix store, so it is realistically not very
secret.
If you would like to be able to modify the contents of this
directories, it is recommended that you make your user a
member of the <literal>btsync</literal> group.
Directories in this list should be in the
<literal>btsync</literal> group, and that group must have
write access to the directory. It is also recommended that
<literal>chmod g+s</literal> is applied to the directory
so that any sub directories created will also belong to
the <literal>btsync</literal> group. Also,
<literal>setfacl -d -m group:btsync:rwx</literal> and
<literal>setfacl -m group:btsync:rwx</literal> should also
be applied so that the sub directories are writable by
the group.
'';
};
};
};
config = mkIf cfg.enable {
assertions =
[ { assertion = cfg.deviceName != "";
message = "Device name cannot be empty.";
}
{ assertion = cfg.enableWebUI -> cfg.sharedFolders == [];
message = "If using shared folders, the web UI cannot be enabled.";
}
{ assertion = cfg.apiKey != "" -> cfg.enableWebUI;
message = "If you're using an API key, you must enable the web server.";
}
];
services.btsync.package = mkOptionDefault pkgs.bittorrentSync14;
users.users.btsync = {
description = "Bittorrent Sync Service user";
home = cfg.storagePath;
createHome = true;
uid = config.ids.uids.btsync;
group = "btsync";
};
users.groups = [
{ name = "btsync";
}];
systemd.services.btsync = with pkgs; {
description = "Bittorrent Sync Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "local-fs.target" ];
serviceConfig = {
Restart = "on-abort";
UMask = "0002";
User = "btsync";
ExecStart =
"${bittorrentSync}/bin/btsync --nodaemon --config ${configFile}";
};
};
systemd.user.services.btsync = with pkgs; {
description = "Bittorrent Sync user service";
after = [ "network.target" "local-fs.target" ];
serviceConfig = {
Restart = "on-abort";
ExecStart =
"${bittorrentSync}/bin/btsync --nodaemon --config %h/.config/btsync.conf";
};
};
environment.systemPackages = [ cfg.package ];
};
}

View File

@ -1,9 +0,0 @@
{ stdenv, fetchurl, ... } @ args:
import ./generic.nix (args // {
version = "1.4.111";
sha256s = {
"x86_64-linux" = "0bw3ds3ndcnkry5mpv645z2bfi5z387bh0f7b35blxq1yv93r83f";
"i686-linux" = "1qwaj7l7nsd4afx7ksb4b1c22mki9qa40803v9x1a8bhbdfhkczk";
};
})

View File

@ -1,9 +0,0 @@
{ stdenv, fetchurl, ... } @ args:
import ./generic.nix (args // {
version = "2.3.8";
sha256s = {
"x86_64-linux" = "02n5s561cz3mprg682mrbmh3qai42dh64jgi05rqy9s6wgbn66ly";
"i686-linux" = "118qrnxc7gvm30rsz0xfx6dlxmrr0dk5ajrvszhy06ww7xvqhzji";
};
})

View File

@ -1,41 +0,0 @@
{ stdenv, fetchurl, version, sha256s, ... }:
let
arch = {
"x86_64-linux" = "x64";
"i686-linux" = "i386";
}.${stdenv.hostPlatform.system} or throwSystem;
libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.libc ];
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation rec {
name = "btsync-${version}";
inherit version;
src = fetchurl {
# annoyingly, downloads for 1.4 and 2.3 do not follow the same URL layout; this is
# a simple work-around, in place of overriding the url in the caller.
urls = [
"https://download-cdn.getsync.com/${version}/linux-${arch}/BitTorrent-Sync_${arch}.tar.gz"
"http://syncapp.bittorrent.com/${version}/btsync_${arch}-${version}.tar.gz"
];
sha256 = sha256s.${stdenv.hostPlatform.system} or throwSystem;
};
dontStrip = true; # Don't strip, otherwise patching the rpaths breaks
sourceRoot = ".";
installPhase = ''
install -D btsync "$out/bin/btsync"
patchelf --interpreter "$(< $NIX_CC/nix-support/dynamic-linker)" --set-rpath ${libPath} "$out/bin/btsync"
'';
meta = {
description = "Automatically sync files via secure, distributed technology";
homepage = https://www.getsync.com/;
license = stdenv.lib.licenses.unfreeRedistributable;
platforms = stdenv.lib.platforms.linux;
maintainers = with stdenv.lib.maintainers; [ domenkozar thoughtpolice cwoac ];
};
}

View File

@ -49,6 +49,9 @@ mapAliases ({
bashCompletion = bash-completion; # Added 2016-09-28
bridge_utils = bridge-utils; # added 2015-02-20
btrfsProgs = btrfs-progs; # added 2016-01-03
bittorrentSync = throw "bittorrentSync has been deprecated by resilio-sync."; # added 2019-06-03
bittorrentSync14 = throw "bittorrentSync14 has been deprecated by resilio-sync."; # added 2019-06-03
bittorrentSync20 = throw "bittorrentSync20 has been deprecated by resilio-sync."; # added 2019-06-03
buildPerlPackage = perlPackages.buildPerlPackage; # added 2018-10-12
bundler_HEAD = bundler; # added 2015-11-15
cantarell_fonts = cantarell-fonts; # added 2018-03-03

View File

@ -20043,10 +20043,6 @@ in
resilio-sync = callPackage ../applications/networking/resilio-sync { };
bittorrentSync = bittorrentSync14;
bittorrentSync14 = callPackage ../applications/networking/bittorrentsync/1.4.x.nix { };
bittorrentSync20 = callPackage ../applications/networking/bittorrentsync/2.0.x.nix { };
dropbox = callPackage ../applications/networking/dropbox { };
dropbox-cli = callPackage ../applications/networking/dropbox/cli.nix { };