summaryrefslogtreecommitdiffstats
path: root/makefu
diff options
context:
space:
mode:
Diffstat (limited to 'makefu')
-rw-r--r--makefu/3modules/rtorrent.nix41
1 files changed, 19 insertions, 22 deletions
diff --git a/makefu/3modules/rtorrent.nix b/makefu/3modules/rtorrent.nix
index 441707727..bdee90236 100644
--- a/makefu/3modules/rtorrent.nix
+++ b/makefu/3modules/rtorrent.nix
@@ -11,11 +11,14 @@ let
fpm-socket = "/var/run/php5-fpm-rutorrent.sock";
webdir = rucfg.webdir;
+ systemd-logfile = cfg.workDir + "/rtorrent-systemd.log";
+
+ # must be in path of php-fpm and rtorrent when started ...
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" [])
-;
+ trace "not enabling unfree packages for rutorrent because allowUnfree is unset" []);
+
rutorrent = pkgs.stdenv.mkDerivation {
name = "rutorrent-src-3.7";
src = pkgs.fetchFromGitHub {
@@ -24,6 +27,7 @@ let
rev = "b727523a153454d4976f04b0c47336ae57cc50d5";
sha256 = "0s5wa0jnck781amln9c2p4pc0i5mq3j5693ra151lnwhz63aii4a";
};
+
phases = [ "patchPhase" "installPhase" ];
patchPhase = ''
cp -r $src src/
@@ -37,7 +41,7 @@ let
echo "replacing scgi port and host variable in conf/config.php"
'';
};
- systemd-logfile = cfg.workDir + "/rtorrent-systemd.log";
+
configFile = pkgs.writeText "rtorrent-config" ''
# THIS FILE IS AUTOGENERATED
${optionalString (cfg.listenPort != null) ''
@@ -46,7 +50,7 @@ let
''}
${optionalString (cfg.watchDir != null) ''
- schedule = watch_directory,5,5load_start=${cfg.watchDir}/*.torrent
+ schedule = watch_directory,5,5,load_start=${cfg.watchDir}/*.torrent
''}
directory = ${cfg.downloadDir}
@@ -68,8 +72,6 @@ let
log.add_output = "notice", "rtorrent-systemd"
log.add_output = "info", "rtorrent-systemd"
# log.add_output = "debug", "rtorrent-systemd"
- log.execute = ${systemd-logfile}.execute
- log.xmlrpc = ${systemd-logfile}.xmlrpc
${cfg.extraConfig}
'';
@@ -163,14 +165,6 @@ let
default = true;
};
- logLevel = mkOption {
- type = types.str;
- description = ''
- Log level to be used for systemd log
- '';
- default = "warn";
- };
-
downloadDir = mkOption {
type = types.path;
description = ''
@@ -210,6 +204,10 @@ let
see ${cfg.package}/share/doc/rtorrent/rtorrent.rc
'';
+ example = literalExample ''
+ log.execute = ${config.makefu.rtorrent.workDir}/execute.log
+ log.xmlrpc = ${config.makefu.rtorrent.workDir}/xmlrpc.log
+ '';
default = "";
};
@@ -248,9 +246,10 @@ let
'';
ExecStart = "${pkgs.tmux.bin}/bin/tmux new-session -s rt -n rtorrent -d 'PATH=/bin:/usr/bin:${makeBinPath rutorrent-deps} ${cfg.package}/bin/rtorrent'";
- # PrivateTmp = true;
- ## now you can simply sudo -u rtorrent tmux a
+ ## you can simply sudo -u rtorrent tmux a if privateTmp is set to false
## otherwise the tmux session is stored in some private folder in /tmp
+ PrivateTmp = false;
+
WorkingDirectory = cfg.workDir;
Restart = "on-failure";
User = "${cfg.user}";
@@ -268,7 +267,6 @@ let
} // (optionalAttrs webcfg.enable {
rutorrent-prepare = {
after = [ "rtorrent-daemon.service" ];
- bindsTo = [ "rtorrent-daemon.service" ];
wantedBy = [ "rtorrent-daemon.service" ];
serviceConfig = {
Type = "oneshot";
@@ -277,7 +275,8 @@ let
ExecStart = pkgs.writeDash "create-webconfig-dir" ''
if [ ! -e ${webdir} ];then
echo "creating webconfiguration directory for rutorrent: ${webdir}"
- cp -r ${rucfg.package} ${webdir}
+ cp -vr ${rucfg.package} ${webdir}
+ echo "setting permissions for webdir to ${cfg.user}:${nginx-group}"
chown -R ${cfg.user}:${nginx-group} ${webdir}
chmod -R 770 ${webdir}
else
@@ -293,7 +292,7 @@ let
users.rtorrent = {
uid = genid "rtorrent";
home = cfg.workDir;
- group = nginx-group;
+ group = nginx-group; # required for rutorrent to work
shell = "/bin/sh"; #required for tmux
isSystemUser = true;
createHome = true;
@@ -362,6 +361,4 @@ let
};
};
};
-in
-out
-
+in out