yt-dlp: use fetchFromGitHub, use `nix-update-script`, generate manpages with pandoc (#421372)

authored by

Sandro and committed by
GitHub
8a040f58 22cad72f

+51 -26
+51 -26
pkgs/by-name/yt/yt-dlp/package.nix
··· 1 1 { 2 2 lib, 3 3 python3Packages, 4 - fetchPypi, 4 + fetchFromGitHub, 5 5 ffmpeg-headless, 6 6 rtmpdump, 7 7 atomicparsley, 8 + pandoc, 9 + installShellFiles, 8 10 atomicparsleySupport ? true, 9 11 ffmpegSupport ? true, 10 12 rtmpSupport ? true, 11 13 withAlias ? false, # Provides bin/youtube-dl for backcompat 12 - update-python-libraries, 14 + nix-update-script, 13 15 }: 14 16 15 17 python3Packages.buildPythonApplication rec { ··· 17 19 # The websites yt-dlp deals with are a very moving target. That means that 18 20 # downloads break constantly. Because of that, updates should always be backported 19 21 # to the latest stable release. 20 - version = "2025.6.30"; 22 + version = "2025.06.30"; 21 23 pyproject = true; 22 24 23 - src = fetchPypi { 24 - inherit version; 25 - pname = "yt_dlp"; 26 - hash = "sha256-bQroVcClW/zCjf+6gE7IUlublV00pBGRoVYaTOwD2L0="; 25 + src = fetchFromGitHub { 26 + owner = "yt-dlp"; 27 + repo = "yt-dlp"; 28 + tag = version; 29 + hash = "sha256-dwBe6oXh7G67kfiI6BqiC0ZHzleR7QlfMiTVXWYW85I="; 27 30 }; 28 31 29 - build-system = with python3Packages; [ 30 - hatchling 32 + build-system = with python3Packages; [ hatchling ]; 33 + 34 + nativeBuildInputs = [ 35 + installShellFiles 36 + pandoc 31 37 ]; 32 38 33 39 # expose optional-dependencies, but provide all features ··· 51 57 }; 52 58 53 59 pythonRelaxDeps = [ "websockets" ]; 60 + 61 + preBuild = '' 62 + python devscripts/make_lazy_extractors.py 63 + ''; 64 + 65 + postBuild = '' 66 + python devscripts/prepare_manpage.py yt-dlp.1.temp.md 67 + pandoc -s -f markdown-smart -t man yt-dlp.1.temp.md -o yt-dlp.1 68 + rm yt-dlp.1.temp.md 69 + 70 + mkdir -p completions/{bash,fish,zsh} 71 + python devscripts/bash-completion.py completions/bash/yt-dlp 72 + python devscripts/zsh-completion.py completions/zsh/_yt-dlp 73 + python devscripts/fish-completion.py completions/fish/yt-dlp.fish 74 + ''; 54 75 55 76 # Ensure these utilities are available in $PATH: 56 77 # - ffmpeg: post-processing & transcoding support ··· 68 89 ''--prefix PATH : "${lib.makeBinPath packagesToBinPath}"'' 69 90 ]; 70 91 71 - setupPyBuildFlags = [ 72 - "build_lazy_extractors" 73 - ]; 74 - 75 92 # Requires network 76 93 doCheck = false; 77 94 78 - postInstall = lib.optionalString withAlias '' 79 - ln -s "$out/bin/yt-dlp" "$out/bin/youtube-dl" 80 - ''; 95 + postInstall = 96 + '' 97 + installManPage yt-dlp.1 81 98 82 - passthru.updateScript = [ 83 - update-python-libraries 84 - (toString ./.) 85 - ]; 99 + installShellCompletion \ 100 + --bash completions/bash/yt-dlp \ 101 + --fish completions/fish/yt-dlp.fish \ 102 + --zsh completions/zsh/_yt-dlp 86 103 87 - meta = with lib; { 104 + install -Dm644 Changelog.md README.md -t "$out/share/doc/yt_dlp" 105 + '' 106 + + lib.optionalString withAlias '' 107 + ln -s "$out/bin/yt-dlp" "$out/bin/youtube-dl" 108 + ''; 109 + 110 + passthru.updateScript = nix-update-script { }; 111 + 112 + meta = { 113 + changelog = "https://github.com/yt-dlp/yt-dlp/blob/${version}/Changelog.md"; 114 + description = "Command-line tool to download videos from YouTube.com and other sites (youtube-dl fork)"; 88 115 homepage = "https://github.com/yt-dlp/yt-dlp/"; 89 - description = "Command-line tool to download videos from YouTube.com and other sites (youtube-dl fork)"; 116 + license = lib.licenses.unlicense; 90 117 longDescription = '' 91 118 yt-dlp is a youtube-dl fork based on the now inactive youtube-dlc. 92 119 ··· 95 122 youtube-dl is released to the public domain, which means 96 123 you can modify it, redistribute it or use it however you like. 97 124 ''; 98 - changelog = "https://github.com/yt-dlp/yt-dlp/blob/HEAD/Changelog.md"; 99 - license = licenses.unlicense; 100 - maintainers = with maintainers; [ 125 + mainProgram = "yt-dlp"; 126 + maintainers = with lib.maintainers; [ 101 127 SuperSandro2000 102 128 donteatoreo 103 129 ]; 104 - mainProgram = "yt-dlp"; 105 130 }; 106 131 }