From aa415e8988fe1246f7efac6defe15af0f0752e67 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Tue, 1 Jul 2025 04:15:05 +0300 Subject: [PATCH 1/5] yt-dlp: use `fetchFromGitHub` --- pkgs/by-name/yt/yt-dlp/package.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index 4ed1feb8a6f0..e4aedcfdfb6e 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -1,7 +1,7 @@ { lib, python3Packages, - fetchPypi, + fetchFromGitHub, ffmpeg-headless, rtmpdump, atomicparsley, @@ -17,13 +17,14 @@ python3Packages.buildPythonApplication rec { # The websites yt-dlp deals with are a very moving target. That means that # downloads break constantly. Because of that, updates should always be backported # to the latest stable release. - version = "2025.6.30"; + version = "2025.06.30"; pyproject = true; - src = fetchPypi { - inherit version; - pname = "yt_dlp"; - hash = "sha256-bQroVcClW/zCjf+6gE7IUlublV00pBGRoVYaTOwD2L0="; + src = fetchFromGitHub { + owner = "yt-dlp"; + repo = "yt-dlp"; + tag = version; + hash = "sha256-dwBe6oXh7G67kfiI6BqiC0ZHzleR7QlfMiTVXWYW85I="; }; build-system = with python3Packages; [ @@ -95,7 +96,7 @@ python3Packages.buildPythonApplication rec { youtube-dl is released to the public domain, which means you can modify it, redistribute it or use it however you like. ''; - changelog = "https://github.com/yt-dlp/yt-dlp/blob/HEAD/Changelog.md"; + changelog = "https://github.com/yt-dlp/yt-dlp/blob/${version}/Changelog.md"; license = licenses.unlicense; maintainers = with maintainers; [ SuperSandro2000 From 14f75ec36686a00b12f467eab8a892437c46ff45 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Tue, 1 Jul 2025 04:18:16 +0300 Subject: [PATCH 2/5] yt-dlp: use `nix-update-script` --- pkgs/by-name/yt/yt-dlp/package.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index e4aedcfdfb6e..a2d2e211db30 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -9,7 +9,7 @@ ffmpegSupport ? true, rtmpSupport ? true, withAlias ? false, # Provides bin/youtube-dl for backcompat - update-python-libraries, + nix-update-script, }: python3Packages.buildPythonApplication rec { @@ -80,10 +80,7 @@ python3Packages.buildPythonApplication rec { ln -s "$out/bin/yt-dlp" "$out/bin/youtube-dl" ''; - passthru.updateScript = [ - update-python-libraries - (toString ./.) - ]; + passthru.updateScript = nix-update-script { }; meta = with lib; { homepage = "https://github.com/yt-dlp/yt-dlp/"; From b0de10fe5af0266e1e1c87b365f0014e197d839e Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Wed, 2 Jul 2025 15:21:20 +0300 Subject: [PATCH 3/5] yt-dlp: generate manpages with pandoc --- pkgs/by-name/yt/yt-dlp/package.nix | 45 ++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index a2d2e211db30..a08ff7c4c6ca 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -5,6 +5,8 @@ ffmpeg-headless, rtmpdump, atomicparsley, + pandoc, + installShellFiles, atomicparsleySupport ? true, ffmpegSupport ? true, rtmpSupport ? true, @@ -27,8 +29,11 @@ python3Packages.buildPythonApplication rec { hash = "sha256-dwBe6oXh7G67kfiI6BqiC0ZHzleR7QlfMiTVXWYW85I="; }; - build-system = with python3Packages; [ - hatchling + build-system = with python3Packages; [ hatchling ]; + + nativeBuildInputs = [ + installShellFiles + pandoc ]; # expose optional-dependencies, but provide all features @@ -53,6 +58,21 @@ python3Packages.buildPythonApplication rec { pythonRelaxDeps = [ "websockets" ]; + preBuild = '' + python devscripts/make_lazy_extractors.py + ''; + + postBuild = '' + python devscripts/prepare_manpage.py yt-dlp.1.temp.md + pandoc -s -f markdown-smart -t man yt-dlp.1.temp.md -o yt-dlp.1 + rm yt-dlp.1.temp.md + + mkdir -p completions/{bash,fish,zsh} + python devscripts/bash-completion.py completions/bash/yt-dlp + python devscripts/zsh-completion.py completions/zsh/_yt-dlp + python devscripts/fish-completion.py completions/fish/yt-dlp.fish + ''; + # Ensure these utilities are available in $PATH: # - ffmpeg: post-processing & transcoding support # - rtmpdump: download files over RTMP @@ -69,16 +89,23 @@ python3Packages.buildPythonApplication rec { ''--prefix PATH : "${lib.makeBinPath packagesToBinPath}"'' ]; - setupPyBuildFlags = [ - "build_lazy_extractors" - ]; - # Requires network doCheck = false; - postInstall = lib.optionalString withAlias '' - ln -s "$out/bin/yt-dlp" "$out/bin/youtube-dl" - ''; + postInstall = + '' + installManPage yt-dlp.1 + + installShellCompletion \ + --bash completions/bash/yt-dlp \ + --fish completions/fish/yt-dlp.fish \ + --zsh completions/zsh/_yt-dlp + + install -Dm644 Changelog.md README.md -t "$out/share/doc/yt_dlp" + '' + + lib.optionalString withAlias '' + ln -s "$out/bin/yt-dlp" "$out/bin/youtube-dl" + ''; passthru.updateScript = nix-update-script { }; From 9f869f7f227ca77a877c52246d0a2904b7924257 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:23:22 +0300 Subject: [PATCH 4/5] yt-dlp: sort `meta` --- pkgs/by-name/yt/yt-dlp/package.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index a08ff7c4c6ca..a4ceab04c7b8 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -110,8 +110,10 @@ python3Packages.buildPythonApplication rec { passthru.updateScript = nix-update-script { }; meta = with lib; { - homepage = "https://github.com/yt-dlp/yt-dlp/"; + changelog = "https://github.com/yt-dlp/yt-dlp/blob/${version}/Changelog.md"; description = "Command-line tool to download videos from YouTube.com and other sites (youtube-dl fork)"; + homepage = "https://github.com/yt-dlp/yt-dlp/"; + license = licenses.unlicense; longDescription = '' yt-dlp is a youtube-dl fork based on the now inactive youtube-dlc. @@ -120,12 +122,10 @@ python3Packages.buildPythonApplication rec { youtube-dl is released to the public domain, which means you can modify it, redistribute it or use it however you like. ''; - changelog = "https://github.com/yt-dlp/yt-dlp/blob/${version}/Changelog.md"; - license = licenses.unlicense; + mainProgram = "yt-dlp"; maintainers = with maintainers; [ SuperSandro2000 donteatoreo ]; - mainProgram = "yt-dlp"; }; } From 182bc1e5f931c1ea4d7ce90c5b7111ad02b76a34 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:24:03 +0300 Subject: [PATCH 5/5] yt-dlp: remove `with lib` --- pkgs/by-name/yt/yt-dlp/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index a4ceab04c7b8..92aaee8f2633 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -109,11 +109,11 @@ python3Packages.buildPythonApplication rec { passthru.updateScript = nix-update-script { }; - meta = with lib; { + meta = { changelog = "https://github.com/yt-dlp/yt-dlp/blob/${version}/Changelog.md"; description = "Command-line tool to download videos from YouTube.com and other sites (youtube-dl fork)"; homepage = "https://github.com/yt-dlp/yt-dlp/"; - license = licenses.unlicense; + license = lib.licenses.unlicense; longDescription = '' yt-dlp is a youtube-dl fork based on the now inactive youtube-dlc. @@ -123,7 +123,7 @@ python3Packages.buildPythonApplication rec { you can modify it, redistribute it or use it however you like. ''; mainProgram = "yt-dlp"; - maintainers = with maintainers; [ + maintainers = with lib.maintainers; [ SuperSandro2000 donteatoreo ];