From 938e21973a1dc01375024f27d266d3bc6c413cd9 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 24 Aug 2016 17:31:15 +0200 Subject: m 3 rtorrent: put rutorrent into separate package --- makefu/3modules/rtorrent.nix | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'makefu/3modules') diff --git a/makefu/3modules/rtorrent.nix b/makefu/3modules/rtorrent.nix index bdee9023..d6e22a08 100644 --- a/makefu/3modules/rtorrent.nix +++ b/makefu/3modules/rtorrent.nix @@ -13,35 +13,14 @@ let webdir = rucfg.webdir; systemd-logfile = cfg.workDir + "/rtorrent-systemd.log"; - # must be in path of php-fpm and rtorrent when started ... + # rutorrent requires a couple of binaries to be available to either the + # rtorrent process or to phpfpm + rutorrent-deps = with pkgs; [ curl php coreutils procps ffmpeg mediainfo ] ++ (if (config.nixpkgs.config.allowUnfree or false) then trace "enabling unfree packages for rutorrent" [ unrar unzip ] else trace "not enabling unfree packages for rutorrent because allowUnfree is unset" []); - rutorrent = pkgs.stdenv.mkDerivation { - name = "rutorrent-src-3.7"; - src = pkgs.fetchFromGitHub { - owner = "Novik"; - repo = "rutorrent"; - rev = "b727523a153454d4976f04b0c47336ae57cc50d5"; - sha256 = "0s5wa0jnck781amln9c2p4pc0i5mq3j5693ra151lnwhz63aii4a"; - }; - - phases = [ "patchPhase" "installPhase" ]; - patchPhase = '' - cp -r $src src/ - chmod u+w -R src/ - sed -i -e 's#^\s*$scgi_port.*#$scgi_port = 0;#' \ - -e 's#^\s*$scgi_host.*#$scgi_host = "unix://${cfg.xmlrpc-socket}";#' \ - "src/conf/config.php" - ''; - installPhase = '' - cp -r src/ $out - echo "replacing scgi port and host variable in conf/config.php" - ''; - }; - configFile = pkgs.writeText "rtorrent-config" '' # THIS FILE IS AUTOGENERATED ${optionalString (cfg.listenPort != null) '' @@ -120,9 +99,9 @@ let type = types.package; description = '' path to rutorrent package. When using your own ruTorrent package, - make sure you patch the scgi_port and scgi_host. + scgi_port and scgi_host will be patched on startup. ''; - default = rutorrent; + default = pkgs.rutorrent; }; @@ -281,7 +260,12 @@ let chmod -R 770 ${webdir} else echo "not overwriting ${webdir}" + fi + echo "updating xmlrpc-socket with unix://${cfg.xmlrpc-socket}" + sed -i -e 's#^\s*$scgi_port.*#$scgi_port = 0;#' \ + -e 's#^\s*$scgi_host.*#$scgi_host = "unix://${cfg.xmlrpc-socket}";#' \ + "${webdir}/conf/config.php" ''; }; }; -- cgit v1.2.3