transmission works like it should

This commit is contained in:
Ingolf Wagner 2021-12-29 20:37:49 +01:00
parent 9d34f3321f
commit 70f1135cbc
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 26 additions and 81 deletions

View file

@ -81,16 +81,15 @@
enable = true;
path = "/media/syncthing/series";
};
music-library = {
enable = true;
path = "/media/syncthing/music";
};
# todo : no need to place it on encrypted drive
#music-projects = {
# enable = true;
# path = "/home/syncthing/music-projects";
#};
#music-library = {
# enable = true;
# path = "/media/syncthing/music-library";
# rescanInterval = 8 * 3600;
#};
#smartphone-folder = {
# enable = true;
# path = "/media/syncthing/smartphone-folder";

View file

@ -33,51 +33,27 @@ let
# TR_TORRENT_NAME #
# #
#############################################
completionScript = let
completionScript =
let
copy_map = {
"/media/torrent/downloads/series" = "/media/syncthing/series/incoming";
"/media/torrent/downloads/music" = "/media/syncthing/music/incoming";
"/media/torrent/downloads/movies" = "/media/syncthing/movies/incoming";
"/media/torrent/downloads" = "/media/torrent/incoming";
};
copy_script = lib.concatStringsSep "\n" (lib.mapAttrsToList (source: target: ''
copy_script = lib.concatStringsSep "\n" (lib.mapAttrsToList
(source: target: ''
if [[ "$TR_TORRENT_DIR" == "${source}" ]]
then
cp -val "$TR_TORRENT_DIR/$TR_TORRENT_NAME" "${target}/$TR_TORRENT_NAME"
fi
'') copy_map);
'')
copy_map);
in
pkgs.writers.writeBash "torrent-finished" ''
${copy_script}
${pkgs.jq}/bin/jq '{
"token": "'"$PUSHOVER_API_KEY"'",
"user": "'"$PUSHOVER_USER_KEY"'",
"titel": "transmission",
"message": "'"$TR_TORRENT_NAME finished"'"
}' >> /media/torrent/finish.log
${pkgs.jq}/bin/jq '{
"token": "'"$PUSHOVER_API_KEY"'",
"user": "'"$PUSHOVER_USER_KEY"'",
"titel": "transmission",
"message": "'"$TR_TORRENT_NAME finished"'"
}' \
| ${pkgs.curl}/bin/curl \
-sS \
-X POST \
-H 'Content-Type: application/json' \
-d @- \
https://api.pushover.net/1/messages.json
'';
pkgs.writers.writeBash "torrent-finished" copy_script;
in
{
#users.users.transmission = {
# isSystemUser = true;
# uid = config.ids.uids.transmission;
#};
sops.secrets.nordvpn = { };
sops.secrets.transmissionPushover = { };
@ -124,36 +100,6 @@ in
config = { config, pkgs, lib, ... }: {
#services.journalbeat = {
# enable = true;
# extraConfig = ''
# journalbeat.inputs:
# - paths: []
# # Position to start reading from journal. Valid values: head, tail, cursor
# seek: cursor
# # Fallback position if no cursor data is available.
# cursor_seek_fallback: tail
# output.logstash:
# # Boolean flag to enable or disable the output module.
# enabled: true
# # Graylog host and the beats input
# hosts: ["${hostAddress}:5044"]
# # If enabled only a subset of events in a batch of events is transferred per
# # transaction. The number of events to be sent increases up to `bulk_max_size`
# # if no error is encountered.
# slow_start: true
# # The number of seconds to wait before trying to reconnect to Graylog
# # after a network error. After waiting backoff.init seconds, the Beat
# # tries to reconnect. If the attempt fails, the backoff timer is increased
# # exponentially up to backoff.max. After a successful connection, the backoff
# # timer is reset. The default is 1s.
# backoff.init: 1s
# # The maximum number of seconds to wait before attempting to connect to
# # Graylog after a network error. The default is 60s.
# backoff.max: 60s
# '';
#};
services.journald.extraConfig = "SystemMaxUse=1G";
# allow transmission to write in syncthing folders
@ -233,7 +179,7 @@ in
"/run/secrets/transmissionPushover"
];
BindPaths = lib.mkForce [
"/media"
"/media" # this is needed otherwise cp -l is not working
"/var/lib/transmission/.config/transmission-daemon"
];
};

View file

@ -156,7 +156,7 @@ with lib; {
enable = lib.mkDefault false;
id = "gytmq-r2zrx";
watch = false;
devices = [ "porani" "workout" "workhorse" "pepe" "sterni" ];
devices = [ "workhorse" "pepe" "sterni" "robi" ];
versioning = {
type = "simple";
params.keep = "10";