Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 3.00 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; hostPort = 9091 + index; protocol = "tcp"; }
  11.           { containerPort = 51413; hostPort = 51413 + index; protocol = "tcp"; }
  12.           { containerPort = 51413; 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.             settings = {
  44.               rpc-whitelist-enabled = false;
  45.               download-dir = "/transmission/Downloads";
  46.               incomplete-dir = "/transmission/Downloads";
  47.             };
  48.           };
  49.           systemd.services.transmission.serviceConfig.LimitNOFILE = 524288;
  50.         };
  51.       };
  52. in
  53. {
  54.   containers = {
  55.     kms = {
  56.       autoStart = true;
  57.       forwardPorts = [
  58.         { containerPort = 1688; hostPort = 1688; protocol = "tcp"; }
  59.       ];
  60.       extraFlags = [ "-U" ];
  61.       config = {
  62.         services.pykms.enable = true;
  63.       };
  64.     };
  65.   } // (lib.listToAttrs (map genTransmission (lib.range 0 10)));
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement