This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
4
2
[PATCH v2] mpvScripts.webtorrent-hook: init at unstable-2020-04-18
Fix issues pointed out in v1.
---
.../video/mpv/scripts/webtorrent-hook.nix | 32 +++++++++++++++++++
pkgs/top-level/all-packages.nix | 1 +
2 files changed, 33 insertions(+)
create mode 100644 pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
diff --git a/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
new file mode 100644
index 00000000000..f1a26f38297
--- /dev/null
+++ b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
@@ -0,0 +1,32 @@
+ { stdenv, fetchFromGitHub, nodePackages }:
+
+ stdenv.mkDerivation rec {
+ name = "webtorrent-hook";
+ version = "unstable-2020-04-18";
+
+ src = fetchFromGitHub {
+ owner = "noctuid";
+ repo = "mpv-webtorrent-hook";
+ rev = "755c6348e10279cb6049264c319e86afc1f830f3";
+ sha256 = "2igEC1Z2yAObx9boJexFF+b25V2tylyVyNfF7xLd3YI=";
+ };
+
+ dontBuild = true;
+
+ buildInputs = [ nodePackages.webtorrent-cli ];
+
+ installPhase = ''
+ mkdir -p $out/share/mpv/scripts
+ cp webtorrent-hook.lua $out/share/mpv/scripts/
+ '';
+
+ passthru.scriptName = "webtorrent-hook.lua";
+
+ meta = with stdenv.lib; {
+ description = "Stream torrents in mpv using webtorrent-cli";
+ homepage = "https://github.com/noctuid/mpv-webtorrent-hook";
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ yoctocell ];
+ };
+ }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index eb8ba06ac00..cb2c6a61195 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -22869,6 +22869,7 @@ in
mpris = callPackage ../applications/video/mpv/scripts/mpris.nix {};
simple-mpv-webui = callPackage ../applications/video/mpv/scripts/simple-mpv-webui.nix {};
sponsorblock = callPackage ../applications/video/mpv/scripts/sponsorblock.nix {};
+ webtorrent-hook = callPackage ../applications/video/mpv/scripts/webtorrent-hook.nix {};
};
mrpeach = callPackage ../applications/audio/pd-plugins/mrpeach { };
--
2.29.2
On 17:37 16.12.20, yoctocell wrote:
> Fix issues pointed out in v1.
>
> ---
> .../video/mpv/scripts/webtorrent-hook.nix | 32 +++++++++++++++++++
> pkgs/top-level/all-packages.nix | 1 +
> 2 files changed, 33 insertions(+)
> create mode 100644 pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
>
> diff --git a/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
> new file mode 100644
> index 00000000000..f1a26f38297
> --- /dev/null
> +++ b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
> @@ -0,0 +1,32 @@
> +{ stdenv, fetchFromGitHub, nodePackages }:
> +
> +stdenv.mkDerivation rec {
> + name = "webtorrent-hook";
> + version = "unstable-2020-04-18";
> +
> + src = fetchFromGitHub {
> + owner = "noctuid";
> + repo = "mpv-webtorrent-hook";
> + rev = "755c6348e10279cb6049264c319e86afc1f830f3";
> + sha256 = "2igEC1Z2yAObx9boJexFF+b25V2tylyVyNfF7xLd3YI=";
> + };
> +
> + dontBuild = true;
> +
> + buildInputs = [ nodePackages.webtorrent-cli ];
Why is this in buildInputs? The output doesn't seem to depend on it in
any way. Maybe you've to do more adjustments here?
> +
> + installPhase = ''
> + mkdir -p $out/share/mpv/scripts
> + cp webtorrent-hook.lua $out/share/mpv/scripts/
> + '';
> +
> + passthru.scriptName = "webtorrent-hook.lua";
> +
> + meta = with stdenv.lib; {
> + description = "Stream torrents in mpv using webtorrent-cli";
> + homepage = "https://github.com/noctuid/mpv-webtorrent-hook";
> + license = licenses.gpl3;
> + platforms = platforms.linux;
> + maintainers = with maintainers; [ yoctocell ];
> + };
> +}
> diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
> index eb8ba06ac00..cb2c6a61195 100644
> --- a/pkgs/top-level/all-packages.nix
> +++ b/pkgs/top-level/all-packages.nix
> @@ -22869,6 +22869,7 @@ in
> mpris = callPackage ../applications/video/mpv/scripts/mpris.nix {};
> simple-mpv-webui = callPackage ../applications/video/mpv/scripts/simple-mpv-webui.nix {};
> sponsorblock = callPackage ../applications/video/mpv/scripts/sponsorblock.nix {};
> + webtorrent-hook = callPackage ../applications/video/mpv/scripts/webtorrent-hook.nix {};
> };
>
> mrpeach = callPackage ../applications/audio/pd-plugins/mrpeach { };
> --
> 2.29.2
>
On Fri, Dec 25 2020, andi@srht.l.notmuch.email wrote:
> On 17:37 16.12.20, yoctocell wrote:
>> Fix issues pointed out in v1.
>>
>> ---
>> .../video/mpv/scripts/webtorrent-hook.nix | 32 +++++++++++++++++++
>> pkgs/top-level/all-packages.nix | 1 +
>> 2 files changed, 33 insertions(+)
>> create mode 100644 pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
>>
>> diff --git a/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
>> new file mode 100644
>> index 00000000000..f1a26f38297
>> --- /dev/null
>> +++ b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
>> @@ -0,0 +1,32 @@
>> +{ stdenv, fetchFromGitHub, nodePackages }:
>> +
>> +stdenv.mkDerivation rec {
>> + name = "webtorrent-hook";
>> + version = "unstable-2020-04-18";
>> +
>> + src = fetchFromGitHub {
>> + owner = "noctuid";
>> + repo = "mpv-webtorrent-hook";
>> + rev = "755c6348e10279cb6049264c319e86afc1f830f3";
>> + sha256 = "2igEC1Z2yAObx9boJexFF+b25V2tylyVyNfF7xLd3YI=";
>> + };
>> +
>> + dontBuild = true;
>> +
>> + buildInputs = [ nodePackages.webtorrent-cli ];
>
> Why is this in buildInputs? The output doesn't seem to depend on it in
> any way. Maybe you've to do more adjustments here?
The README says that webtorrent-cli is a requirement, see
https://github.com/noctuid/mpv-webtorrent-hook . I tested it without
webtorrent-cli and everything seemed to work fine, so I guess it's not
necessary.
On 22:54 25.12.20, yoctocell wrote:
> On Fri, Dec 25 2020, andi@srht.l.notmuch.email wrote:
>
> > On 17:37 16.12.20, yoctocell wrote:
> >> Fix issues pointed out in v1.
> >>
> >> ---
> >> .../video/mpv/scripts/webtorrent-hook.nix | 32 +++++++++++++++++++
> >> pkgs/top-level/all-packages.nix | 1 +
> >> 2 files changed, 33 insertions(+)
> >> create mode 100644 pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
> >>
> >> diff --git a/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
> >> new file mode 100644
> >> index 00000000000..f1a26f38297
> >> --- /dev/null
> >> +++ b/pkgs/applications/video/mpv/scripts/webtorrent-hook.nix
> >> @@ -0,0 +1,32 @@
> >> +{ stdenv, fetchFromGitHub, nodePackages }:
> >> +
> >> +stdenv.mkDerivation rec {
> >> + name = "webtorrent-hook";
> >> + version = "unstable-2020-04-18";
> >> +
> >> + src = fetchFromGitHub {
> >> + owner = "noctuid";
> >> + repo = "mpv-webtorrent-hook";
> >> + rev = "755c6348e10279cb6049264c319e86afc1f830f3";
> >> + sha256 = "2igEC1Z2yAObx9boJexFF+b25V2tylyVyNfF7xLd3YI=";
> >> + };
> >> +
> >> + dontBuild = true;
> >> +
> >> + buildInputs = [ nodePackages.webtorrent-cli ];
> >
> > Why is this in buildInputs? The output doesn't seem to depend on it in
> > any way. Maybe you've to do more adjustments here?
>
> The README says that webtorrent-cli is a requirement, see
> https://github.com/noctuid/mpv-webtorrent-hook . I tested it without
> webtorrent-cli and everything seemed to work fine, so I guess it's not
> necessary.
>
You probably have `webtorrent-cli` installed on your system.
The script executes "webtorrent"
(https://github.com/noctuid/mpv-webtorrent-hook/blob/master/webtorrent-hook.lua#L67-L71 )
during the runtime. We should probably wrap/patch/… the script so it
find the node program.