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; enable = true;
path = "/media/syncthing/series"; path = "/media/syncthing/series";
}; };
music-library = {
enable = true;
path = "/media/syncthing/music";
};
# todo : no need to place it on encrypted drive # todo : no need to place it on encrypted drive
#music-projects = { #music-projects = {
# enable = true; # enable = true;
# path = "/home/syncthing/music-projects"; # path = "/home/syncthing/music-projects";
#}; #};
#music-library = {
# enable = true;
# path = "/media/syncthing/music-library";
# rescanInterval = 8 * 3600;
#};
#smartphone-folder = { #smartphone-folder = {
# enable = true; # enable = true;
# path = "/media/syncthing/smartphone-folder"; # path = "/media/syncthing/smartphone-folder";

View file

@ -33,53 +33,29 @@ let
# TR_TORRENT_NAME # # TR_TORRENT_NAME #
# # # #
############################################# #############################################
completionScript = let completionScript =
let
copy_map = { 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/movies" = "/media/syncthing/movies/incoming";
"/media/torrent/downloads" = "/media/torrent/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}" ]] if [[ "$TR_TORRENT_DIR" == "${source}" ]]
then then
cp -val "$TR_TORRENT_DIR/$TR_TORRENT_NAME" "${target}/$TR_TORRENT_NAME" cp -val "$TR_TORRENT_DIR/$TR_TORRENT_NAME" "${target}/$TR_TORRENT_NAME"
fi fi
'') copy_map); '')
copy_map);
in in
pkgs.writers.writeBash "torrent-finished" '' pkgs.writers.writeBash "torrent-finished" copy_script;
${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
'';
in in
{ {
#users.users.transmission = {
# isSystemUser = true;
# uid = config.ids.uids.transmission;
#};
sops.secrets.nordvpn = { }; sops.secrets.nordvpn = { };
sops.secrets.transmissionPushover= { }; sops.secrets.transmissionPushover = { };
containers.torrent = { containers.torrent = {
@ -124,42 +100,12 @@ in
config = { config, pkgs, lib, ... }: { 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"; services.journald.extraConfig = "SystemMaxUse=1G";
# allow transmission to write in syncthing folders # allow transmission to write in syncthing folders
users.groups.syncthing = { users.groups.syncthing = {
gid = config.ids.gids.syncthing; gid = config.ids.gids.syncthing;
members = ["transmission"]; members = [ "transmission" ];
}; };
services.transmission = { services.transmission = {
@ -233,7 +179,7 @@ in
"/run/secrets/transmissionPushover" "/run/secrets/transmissionPushover"
]; ];
BindPaths = lib.mkForce [ BindPaths = lib.mkForce [
"/media" "/media" # this is needed otherwise cp -l is not working
"/var/lib/transmission/.config/transmission-daemon" "/var/lib/transmission/.config/transmission-daemon"
]; ];
}; };

View file

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