Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e99a40906518
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 16a4332d60c5
Choose a head ref
  • 5 commits
  • 8 files changed
  • 2 contributors

Commits on Apr 18, 2020

  1. Partially revert "libtorrent-raster: 1.1.11 -> 1.2.5; qbittorrent: 4.…

    …2.1 -> 4.2.2"
    
    This partially reverts commit cc03fb4.
    The libtorrentRasterbar update broke deluge 1.x, the hash was not
    updated and obsolete dependencies and flags were not removed.
    Milan Pässler authored and Milan committed Apr 18, 2020
    Copy the full SHA
    69e7326 View commit details
  2. libtorrent-rasterbar: 1.1.11 -> 1.2.5

    https://raw.githubusercontent.com/arvidn/libtorrent/libtorrent-1_2_5/ChangeLog
    
    The old release is kept available as libtorrentRasterbar-1_1_x for deluge 1.x.
    dtzWill authored and Milan committed Apr 18, 2020
    Copy the full SHA
    ca722c5 View commit details
  3. deluge: 1.3.15 -> 2.0.3

    * let's try 2.0 version now, no time better than the present! Maybe!
    * bz2 -> xz
    * maybe python3
    * disable pyGtkGlade for deps, maybe not needed?
    * fix gtk/etc deps, deluge-gtk works! \o/
    * restore installation of images and such
    
    The old version is kept available as some torrent trackers have not
    updated their whitelists yet.
    dtzWill authored and Milan committed Apr 18, 2020
    Copy the full SHA
    9ae8499 View commit details
  4. deluge: remove use of deprecated alias

    dtzWill authored and Milan committed Apr 18, 2020
    Copy the full SHA
    fee776a View commit details
  5. nixos/deluge: support 2.x

    Milan Pässler authored and Milan committed Apr 18, 2020
    Copy the full SHA
    16a4332 View commit details
10 changes: 9 additions & 1 deletion nixos/doc/manual/release-notes/rl-2009.xml
Original file line number Diff line number Diff line change
@@ -203,6 +203,15 @@ environment.systemPackages = [
<link xlink:href="https://github.com/gollum/gollum/wiki/5.0-release-notes#migrating-your-wiki">here</link>.
</para>
</listitem>
<listitem>
<para>
Deluge 2.x was added and is used as default for new NixOS
installations where stateVersion is >= 20.09. If you are upgrading from a previous
NixOS version, you can set <literal>service.deluge.package = pkgs.deluge-2_x</literal>
to upgrade to Deluge 2.x and migrate the state to the new format.
Be aware that backwards state migrations are not supported by Deluge.
</para>
</listitem>

<listitem>
<para>
@@ -246,7 +255,6 @@ environment.systemPackages = [
# sudo /run/current-system/fine-tune/child-1/bin/switch-to-configuration test
</programlisting>
</para>
</listitem>
</itemizedlist>
</section>

31 changes: 24 additions & 7 deletions nixos/modules/services/torrent/deluge.nix
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ with lib;
let
cfg = config.services.deluge;
cfg_web = config.services.deluge.web;
isDeluge1 = versionOlder cfg.package.version "2.0.0";

openFilesLimit = 4096;
listenPortsDefault = [ 6881 6889 ];
@@ -18,11 +19,11 @@ let
preStart = if cfg.declarative then ''
if [ -e ${declarativeLockFile} ]; then
# Was declarative before, no need to back up anything
ln -sf ${configFile} ${configDir}/core.conf
${if isDeluge1 then "ln -sf" else "cp"} ${configFile} ${configDir}/core.conf
ln -sf ${cfg.authFile} ${configDir}/auth
else
# Declarative for the first time, backup stateful files
ln -sb --suffix=.stateful ${configFile} ${configDir}/core.conf
${if isDeluge1 then "ln -s" else "cp"} -b --suffix=.stateful ${configFile} ${configDir}/core.conf
ln -sb --suffix=.stateful ${cfg.authFile} ${configDir}/auth
echo "Autogenerated file that signifies that this server configuration is managed declaratively by NixOS" \
> ${declarativeLockFile}
@@ -144,6 +145,14 @@ in {
This always contains unzip, gnutar, xz, p7zip and bzip2.
'';
};

package = mkOption {
type = types.package;
example = literalExample "pkgs.deluge-1_x";
description = ''
Deluge package to use.
'';
};
};

deluge.web = {
@@ -170,6 +179,13 @@ in {

config = mkIf cfg.enable {

services.deluge.package = mkDefault (
if versionAtLeast config.system.stateVersion "20.09" then
pkgs.deluge-2_x
else
pkgs.deluge-1_x
);

# Provide a default set of `extraPackages`.
services.deluge.extraPackages = with pkgs; [ unzip gnutar xz p7zip bzip2 ];

@@ -189,10 +205,10 @@ in {
after = [ "network.target" ];
description = "Deluge BitTorrent Daemon";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.deluge ] ++ cfg.extraPackages;
path = [ cfg.package ] ++ cfg.extraPackages;
serviceConfig = {
ExecStart = ''
${pkgs.deluge}/bin/deluged \
${cfg.package}/bin/deluged \
--do-not-daemonize \
--config ${configDir}
'';
@@ -212,10 +228,11 @@ in {
requires = [ "deluged.service" ];
description = "Deluge BitTorrent WebUI";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.deluge ];
path = [ cfg.package ];
serviceConfig = {
ExecStart = ''
${pkgs.deluge}/bin/deluge-web \
${cfg.package}/bin/deluge-web \
${optionalString (!isDeluge1) "--do-not-daemonize"} \
--config ${configDir} \
--port ${toString cfg.web.port}
'';
@@ -234,7 +251,7 @@ in {
})
];

environment.systemPackages = [ pkgs.deluge ];
environment.systemPackages = [ cfg.package ];

users.users = mkIf (cfg.user == "deluge") {
deluge = {
109 changes: 76 additions & 33 deletions nixos/tests/deluge.nix
Original file line number Diff line number Diff line change
@@ -5,60 +5,103 @@ import ./make-test-python.nix ({ pkgs, ...} : {
};

nodes = {
simple = {
simple1 = {
services.deluge = {
enable = true;
package = pkgs.deluge-1_x;
web = {
enable = true;
openFirewall = true;
};
};
};

declarative =
{ ... }:
declarative1 = {
services.deluge = {
enable = true;
package = pkgs.deluge-1_x;
openFirewall = true;
declarative = true;
config = {
allow_remote = true;
download_location = "/var/lib/deluge/my-download";
daemon_port = 58846;
listen_ports = [ 6881 6889 ];
};
web = {
enable = true;
port = 3142;
};
authFile = pkgs.writeText "deluge-auth" ''
localclient:a7bef72a890:10
andrew:password:10
user3:anotherpass:5
'';
};
};

{
services.deluge = {
simple2 = {
services.deluge = {
enable = true;
package = pkgs.deluge-2_x;
web = {
enable = true;
openFirewall = true;
declarative = true;
config = {
allow_remote = true;
download_location = "/var/lib/deluge/my-download";
daemon_port = 58846;
listen_ports = [ 6881 6889 ];
};
web = {
enable = true;
port = 3142;
};
authFile = pkgs.writeText "deluge-auth" ''
localclient:a7bef72a890:10
andrew:password:10
user3:anotherpass:5
'';
};
environment.systemPackages = [ pkgs.deluge ];
};
};

declarative2 = {
services.deluge = {
enable = true;
package = pkgs.deluge-2_x;
openFirewall = true;
declarative = true;
config = {
allow_remote = true;
download_location = "/var/lib/deluge/my-download";
daemon_port = 58846;
listen_ports = [ 6881 6889 ];
};
web = {
enable = true;
port = 3142;
};
authFile = pkgs.writeText "deluge-auth" ''
localclient:a7bef72a890:10
andrew:password:10
user3:anotherpass:5
'';
};
};

};

testScript = ''
start_all()
simple.wait_for_unit("deluged")
simple.wait_for_unit("delugeweb")
simple.wait_for_open_port("8112")
declarative.wait_for_unit("network.target")
declarative.wait_until_succeeds("curl --fail http://simple:8112")
simple1.wait_for_unit("deluged")
simple2.wait_for_unit("deluged")
simple1.wait_for_unit("delugeweb")
simple2.wait_for_unit("delugeweb")
simple1.wait_for_open_port("8112")
simple2.wait_for_open_port("8112")
declarative1.wait_for_unit("network.target")
declarative2.wait_for_unit("network.target")
declarative1.wait_until_succeeds("curl --fail http://simple1:8112")
declarative2.wait_until_succeeds("curl --fail http://simple2:8112")
declarative.wait_for_unit("deluged")
declarative.wait_for_unit("delugeweb")
declarative.wait_until_succeeds("curl --fail http://declarative:3142")
declarative.succeed("deluge-console 'help' | grep -q 'rm - Remove a torrent'")
declarative.succeed(
"deluge-console 'connect 127.0.0.1:58846 andrew password; help' | grep -q 'rm - Remove a torrent'"
declarative1.wait_for_unit("deluged")
declarative2.wait_for_unit("deluged")
declarative1.wait_for_unit("delugeweb")
declarative2.wait_for_unit("delugeweb")
declarative1.wait_until_succeeds("curl --fail http://declarative1:3142")
declarative2.wait_until_succeeds("curl --fail http://declarative2:3142")
declarative1.succeed(
"deluge-console 'connect 127.0.0.1:58846 andrew password; help' | grep -q 'rm.*Remove a torrent'"
)
declarative2.succeed(
"deluge-console 'connect 127.0.0.1:58846 andrew password; help' | grep -q 'rm.*Remove a torrent'"
)
'';
})
44 changes: 44 additions & 0 deletions pkgs/applications/networking/p2p/deluge/2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{ stdenv, fetchurl, intltool, libtorrentRasterbar, pythonPackages
, gtk3, gobject-introspection, librsvg, wrapGAppsHook }:

pythonPackages.buildPythonPackage rec {
pname = "deluge";
version = "2.0.3";

src = fetchurl {
url = "http://download.deluge-torrent.org/source/2.0/${pname}-${version}.tar.xz";
sha256 = "14d8kn2pvr1qv8mwqrxmj85jycr73vwfqz12hzag0ararbkfhyky";
};

propagatedBuildInputs = with pythonPackages; [
twisted Mako chardet pyxdg pyopenssl service-identity
libtorrentRasterbar.dev libtorrentRasterbar.python setuptools
setproctitle pillow rencode six zope_interface
dbus-python pygobject3 pycairo
gtk3 gobject-introspection librsvg
];

nativeBuildInputs = [ intltool wrapGAppsHook ];

checkInputs = with pythonPackages; [
pytest /* pytest-twisted */ pytestcov mock
mccabe pylint
];

doCheck = false; # until pytest-twisted is packaged

postInstall = ''
mkdir -p $out/share/applications
cp -R deluge/ui/data/pixmaps $out/share/
cp -R deluge/ui/data/icons $out/share/
cp deluge/ui/data/share/applications/deluge.desktop $out/share/applications
'';

meta = with stdenv.lib; {
homepage = "https://deluge-torrent.org";
description = "Torrent client";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ domenkozar ebzzry ];
platforms = platforms.all;
};
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ stdenv, lib, fetchFromGitHub, pkgconfig, automake, autoconf
, zlib, boost, openssl, libtool, python, libiconv, geoip, ncurses
, zlib, boost, openssl, libtool, python, libiconv, ncurses
}:

let
version = "1.2.5";
version = "1.1.11";
formattedVersion = lib.replaceChars ["."] ["_"] version;

# Make sure we override python, so the correct version is chosen
@@ -17,14 +17,13 @@ in stdenv.mkDerivation {
src = fetchFromGitHub {
owner = "arvidn";
repo = "libtorrent";
rev = "libtorrent-${formattedVersion}";
rev = "libtorrent_${formattedVersion}";
sha256 = "0nwdsv6d2gkdsh7l5a46g6cqx27xwh3msify5paf02l1qzjy4s5l";
};

enableParallelBuilding = true;
nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
buildInputs = [ boostPython openssl zlib python libiconv geoip ncurses ];

buildInputs = [ boostPython openssl zlib python libiconv ncurses ];
preConfigure = "./autotool.sh";

postInstall = ''
@@ -36,11 +35,9 @@ in stdenv.mkDerivation {

configureFlags = [
"--enable-python-binding"
"--with-libgeoip=system"
"--with-libiconv=yes"
"--with-boost=${boostPython.dev}"
"--with-boost-libdir=${boostPython.out}/lib"
"--with-libiconv=yes"
];

meta = with stdenv.lib; {
50 changes: 50 additions & 0 deletions pkgs/development/libraries/libtorrent-rasterbar/1.2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ stdenv, lib, fetchFromGitHub, pkgconfig, automake, autoconf
, zlib, boost, openssl, libtool, python, libiconv, ncurses
}:

let
version = "1.2.5";
formattedVersion = lib.replaceChars ["."] ["_"] version;

# Make sure we override python, so the correct version is chosen
# for the bindings, if overridden
boostPython = boost.override { enablePython = true; inherit python; };

in stdenv.mkDerivation {
pname = "libtorrent-rasterbar";
inherit version;

src = fetchFromGitHub {
owner = "arvidn";
repo = "libtorrent";
rev = "libtorrent-${formattedVersion}";
sha256 = "0y2fzqbvb1bxvf93d7sphwzxih6j40p5p3fay943k26w0nrq802w";
};

enableParallelBuilding = true;
nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
buildInputs = [ boostPython openssl zlib python libiconv ncurses ];
preConfigure = "./autotool.sh";

postInstall = ''
moveToOutput "include" "$dev"
moveToOutput "lib/${python.libPrefix}" "$python"
'';

outputs = [ "out" "dev" "python" ];

configureFlags = [
"--enable-python-binding"
"--with-libiconv=yes"
"--with-boost=${boostPython.dev}"
"--with-boost-libdir=${boostPython.out}/lib"
];

meta = with stdenv.lib; {
homepage = "https://libtorrent.org/";
description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
license = licenses.bsd3;
maintainers = [ maintainers.phreedom ];
platforms = platforms.unix;
};
}
14 changes: 12 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
@@ -2839,9 +2839,15 @@ in

ddrutility = callPackage ../tools/system/ddrutility { };

deluge = callPackage ../applications/networking/p2p/deluge {
deluge-2_x = callPackage ../applications/networking/p2p/deluge/2 {
pythonPackages = python3Packages;
libtorrentRasterbar = libtorrentRasterbar.override { python = python3; };
};
deluge-1_x = callPackage ../applications/networking/p2p/deluge/1 {
pythonPackages = python2Packages;
libtorrentRasterbar = libtorrentRasterbar-1_1_x;
};
deluge = deluge-2_x;

desktop-file-utils = callPackage ../tools/misc/desktop-file-utils { };

@@ -13241,7 +13247,11 @@ in

libtomcrypt = callPackage ../development/libraries/libtomcrypt { };

libtorrentRasterbar = callPackage ../development/libraries/libtorrent-rasterbar { };
libtorrentRasterbar-1_2_x = callPackage ../development/libraries/libtorrent-rasterbar/1.2 { };

libtorrentRasterbar-1_1_x = callPackage ../development/libraries/libtorrent-rasterbar/1.1 { };

libtorrentRasterbar = libtorrentRasterbar-1_2_x;

# this is still the new version of the old API
libtoxcore-new = callPackage ../development/libraries/libtoxcore/new-api.nix { };