Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. { pkgs, lib, ... }:
  2. let
  3. genTransmission = index:
  4. let
  5. name = "transmission" + toString index;
  6. in
  7. lib.nameValuePair name {
  8. autoStart = true;
  9. forwardPorts = [
  10. { containerPort = 9091 + index; hostPort = 9091 + index; protocol = "tcp"; }
  11. { containerPort = 51413 + index; hostPort = 51413 + index; protocol = "tcp"; }
  12. { containerPort = 51413 + index; hostPort = 51413 + index; protocol = "udp"; }
  13. ];
  14. bindMounts = {
  15. "/transmission/Downloads" = { hostPath = "/stereolith/crap/transmission/Downloads"; isReadOnly = false; };
  16. "/var/lib/transmission/.config/transmission-daemon/resume" = { hostPath = "/stereolith/crap/transmission/state/" + name + "/resume"; isReadOnly = false; };
  17. "/var/lib/transmission/.config/transmission-daemon/torrents" = { hostPath = "/stereolith/crap/transmission/state/" + name + "/torrents"; isReadOnly = false; };
  18. };
  19. config = {
  20. nixpkgs.overlays = [ (self: super: {
  21. transmission = super.transmission.overrideAttrs (old: {
  22. buildInputs = with pkgs; [ autoconf automake115x systemd ] ++ old.buildInputs;
  23. postPatch = old.postPatch + ''
  24. substituteInPlace ./configure.ac \
  25. --replace "libsystemd-daemon" "libsystemd" \
  26. --replace "test ! -d /Developer/SDKs/MacOSX10.5.sdk" "false"
  27. '';
  28. patches = builtins.map super.fetchpatch [
  29. { url = "https://raw.githubusercontent.com/WeebDataHoarder/Transmission-AB/master/transmission-Patches/0001-fdlimit-backported-from-3.0.patch";
  30. sha256 = "0y6cmybj8yy08wqay1wl461vpapap9hzn3n7r702kpk5cwjfggyy";
  31. }
  32. { url = "https://raw.githubusercontent.com/WeebDataHoarder/Transmission-AB/master/transmission-Patches/0002-resume-filename-back-to-hash-backported-from-3.0.patch";
  33. sha256 = "1fd62q0a0xdjbirkvs232dpxb3qy55vy7fpx6k2w44zpsp7mgaz0";
  34. }
  35. { url = "https://raw.githubusercontent.com/WeebDataHoarder/Transmission-AB/master/transmission-Patches/0003-semiseq.patch";
  36. sha256 = "0r7fxakmw19zps046s2c1idhwc07zh1azdyw3l6n57p4q5lv6vyw";
  37. }
  38. ];
  39. });
  40. }) ];
  41. services.transmission = {
  42. enable = true;
  43. port = 9091 + index;
  44. settings = {
  45. rpc-whitelist-enabled = false;
  46. peer-port = 51413 + index;
  47. download-dir = "/transmission/Downloads";
  48. incomplete-dir = "/transmission/Downloads";
  49. };
  50. };
  51. systemd.services.transmission.serviceConfig.LimitNOFILE = 524288;
  52. };
  53. };
  54. in
  55. {
  56. containers = {
  57. kms = {
  58. autoStart = true;
  59. forwardPorts = [
  60. { containerPort = 1688; hostPort = 1688; protocol = "tcp"; }
  61. ];
  62. extraFlags = [ "-U" ];
  63. config = {
  64. services.pykms.enable = true;
  65. };
  66. };
  67. } // (lib.listToAttrs (map genTransmission (lib.range 0 10)));
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement