From 2fd6af1929acc4cd2e0da827f016dd988eb66e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20Witters=C3=B8?= Date: Sat, 28 Oct 2023 00:25:35 +0200 Subject: [PATCH] fetchFromBittorrent: Rename to fetchtorrent --- doc/builders/fetchers.chapter.md | 10 +++++----- .../{fetchbittorrent => fetchtorrent}/default.nix | 4 ++-- .../{fetchbittorrent => fetchtorrent}/tests.nix | 10 +++++----- pkgs/test/default.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) rename pkgs/build-support/{fetchbittorrent => fetchtorrent}/default.nix (97%) rename pkgs/build-support/{fetchbittorrent => fetchtorrent}/tests.nix (82%) diff --git a/doc/builders/fetchers.chapter.md b/doc/builders/fetchers.chapter.md index ba7b1b190128..c99b46097e9f 100644 --- a/doc/builders/fetchers.chapter.md +++ b/doc/builders/fetchers.chapter.md @@ -243,21 +243,21 @@ or *** ``` -## `fetchFromBittorrent` {#fetchfrombittorrent} +## `fetchtorrent` {#fetchtorrent} -`fetchFromBittorrent` expects two arguments. `url` which can either be a Magnet URI (Magnet Link) such as `magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c` or an HTTP URL pointing to a `.torrent` file. It can also take a `config` argument which will craft a `settings.json` configuration file and give it to `transmission`, the underlying program that is performing the fetch. The available config options for `transmission` can be found [here](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md#options) +`fetchtorrent` expects two arguments. `url` which can either be a Magnet URI (Magnet Link) such as `magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c` or an HTTP URL pointing to a `.torrent` file. It can also take a `config` argument which will craft a `settings.json` configuration file and give it to `transmission`, the underlying program that is performing the fetch. The available config options for `transmission` can be found [here](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md#options) ``` -{ fetchFromBittorrent }: +{ fetchtorrent }: -fetchFromBittorrent { +fetchtorrent { config = { peer-limit-global = 100; }; url = "magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"; sha256 = ""; } ``` -### Parameters {#fetchfrombittorrent-parameters} +### Parameters {#fetchtorrent-parameters} - `url`: Magnet URI (Magnet Link) such as `magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c` or an HTTP URL pointing to a `.torrent` file. diff --git a/pkgs/build-support/fetchbittorrent/default.nix b/pkgs/build-support/fetchtorrent/default.nix similarity index 97% rename from pkgs/build-support/fetchbittorrent/default.nix rename to pkgs/build-support/fetchtorrent/default.nix index 916c7e7d8c94..beb2415df707 100644 --- a/pkgs/build-support/fetchbittorrent/default.nix +++ b/pkgs/build-support/fetchtorrent/default.nix @@ -30,13 +30,13 @@ let jsonConfig = (formats.json {}).generate "jsonConfig" config; in runCommand name { - nativeBuildInputs = [ cacert ] ++ (if (backend == "transmission" ) then [ transmission_noSystemd ] else if (backend == "rqbit") then [ rqbit ] else throw "rqbit or transmission are the only available backends for fetchbittorrent"); + nativeBuildInputs = [ cacert ] ++ (if (backend == "transmission" ) then [ transmission_noSystemd ] else if (backend == "rqbit") then [ rqbit ] else throw "rqbit or transmission are the only available backends for fetchtorrent"); outputHashAlgo = if hash != "" then null else "sha256"; outputHash = hash; outputHashMode = if recursiveHash then "recursive" else "flat"; # url will be written to the derivation, meaning it can be parsed and utilized - # by external tools, such as tools that may want to seed fetchBittorrent calls + # by external tools, such as tools that may want to seed fetchtorrent calls # in nixpkgs inherit url; } diff --git a/pkgs/build-support/fetchbittorrent/tests.nix b/pkgs/build-support/fetchtorrent/tests.nix similarity index 82% rename from pkgs/build-support/fetchbittorrent/tests.nix rename to pkgs/build-support/fetchtorrent/tests.nix index fce1b3933a72..b36c82c6326f 100644 --- a/pkgs/build-support/fetchbittorrent/tests.nix +++ b/pkgs/build-support/fetchtorrent/tests.nix @@ -1,22 +1,22 @@ -{ testers, fetchFromBittorrent, ... }: +{ testers, fetchtorrent, ... }: { - http-link = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + http-link = testers.invalidateFetcherByDrvHash fetchtorrent { url = "https://webtorrent.io/torrents/wired-cd.torrent"; hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; backend = "transmission"; }; - magnet-link = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + magnet-link = testers.invalidateFetcherByDrvHash fetchtorrent { url = "magnet:?xt=urn:btih:a88fda5954e89178c372716a6a78b8180ed4dad3&dn=The+WIRED+CD+-+Rip.+Sample.+Mash.+Share&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fwired-cd.torrent"; hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; backend = "transmission"; }; - http-link-rqbit = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + http-link-rqbit = testers.invalidateFetcherByDrvHash fetchtorrent { url = "https://webtorrent.io/torrents/wired-cd.torrent"; hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; backend = "rqbit"; }; - magnet-link-rqbit = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + magnet-link-rqbit = testers.invalidateFetcherByDrvHash fetchtorrent { url = "magnet:?xt=urn:btih:a88fda5954e89178c372716a6a78b8180ed4dad3&dn=The+WIRED+CD+-+Rip.+Sample.+Mash.+Share&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fwired-cd.torrent"; hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; backend = "rqbit"; diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 4cc9ecc0db3e..595c3413d5e1 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -104,7 +104,7 @@ with pkgs; cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; }; fetchurl = callPackages ../build-support/fetchurl/tests.nix { }; - fetchFromBittorrent = callPackages ../build-support/fetchbittorrent/tests.nix { }; + fetchtorrent = callPackages ../build-support/fetchtorrent/tests.nix { }; fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { }; fetchpatch2 = callPackages ../build-support/fetchpatch/tests.nix { fetchpatch = fetchpatch2; }; fetchDebianPatch = callPackages ../build-support/fetchdebianpatch/tests.nix { }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2cf790efdc52..7c53be487167 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1118,7 +1118,7 @@ with pkgs; fetchs3 = callPackage ../build-support/fetchs3 { }; - fetchFromBittorrent = callPackage ../build-support/fetchbittorrent { }; + fetchtorrent = callPackage ../build-support/fetchtorrent { }; fetchsvn = if stdenv.buildPlatform != stdenv.hostPlatform # hack around splicing being crummy with things that (correctly) don't eval.