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 ++++++++++-------------------------- makefu/5pkgs/default.nix | 1 + makefu/5pkgs/rutorrent/default.nix | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 makefu/5pkgs/rutorrent/default.nix (limited to 'makefu') diff --git a/makefu/3modules/rtorrent.nix b/makefu/3modules/rtorrent.nix index bdee90236..d6e22a08d 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" ''; }; }; diff --git a/makefu/5pkgs/default.nix b/makefu/5pkgs/default.nix index 51987c35b..eaa916f94 100644 --- a/makefu/5pkgs/default.nix +++ b/makefu/5pkgs/default.nix @@ -18,6 +18,7 @@ in mycube-flask = callPackage ./mycube-flask {}; nodemcu-uploader = callPackage ./nodemcu-uploader {}; ps3netsrv = callPackage ./ps3netsrv {}; + rutorrent = callPackage ./rutorrent {}; tw-upload-plugin = callPackage ./tw-upload-plugin {}; skytraq-logger = callPackage ./skytraq-logger {}; taskserver = callPackage ./taskserver {}; diff --git a/makefu/5pkgs/rutorrent/default.nix b/makefu/5pkgs/rutorrent/default.nix new file mode 100644 index 000000000..5a2259552 --- /dev/null +++ b/makefu/5pkgs/rutorrent/default.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +pkgs.stdenv.mkDerivation { + name = "rutorrent-src-3.7"; + src = pkgs.fetchFromGitHub { + owner = "Novik"; + repo = "rutorrent"; + rev = "b727523a153454d4976f04b0c47336ae57cc50d5"; + sha256 = "0s5wa0jnck781amln9c2p4pc0i5mq3j5693ra151lnwhz63aii4a"; + }; + + phases = [ "installPhase" ]; + installPhase = '' + cp -r $src $out + ''; +} -- cgit v1.2.3