aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/yt
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/yt/yt/package.nix125
-rw-r--r--pkgs/by-name/yt/yti/package.nix17
-rwxr-xr-xpkgs/by-name/yt/yti/yti.sh33
3 files changed, 89 insertions, 86 deletions
diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix
index 90a70473..41234e19 100644
--- a/pkgs/by-name/yt/yt/package.nix
+++ b/pkgs/by-name/yt/yt/package.nix
@@ -1,38 +1,77 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
+ lib,
+ rustPlatform,
+ installShellFiles,
fetchgit,
- ffmpeg,
gitUpdater,
- glibc,
- lib,
- llvmPackages_latest,
- makeWrapper,
+ # buildInputs
mpv-unwrapped,
+ ffmpeg-headless,
+ openssl,
+ libffi,
+ zlib,
+ curl,
+ deno,
+ # NativeBuildInputs
python3,
- rustPlatform,
+ makeWrapper,
+ llvmPackages_latest,
+ glibc,
+ mold,
sqlite,
- blake3,
+ fd,
+ pkg-config,
+ SDL2,
}: let
- version = "1.4.1";
+ version = "1.9.0";
+ python = python3.withPackages (ps: [ps.yt-dlp]);
- src = fetchgit {
- url = "https://git.foss-syndicate.org/bpeetz/clients/yt";
- rev = "v${version}";
- hash = "sha256-Zuc3hrhvYdz2ktQhfMcLX7E5W/ZneMMLJ6+CoJ/JZMs=";
- };
-
- buildInputs = [
- (python3.withPackages (ps: [ps.yt-dlp blake3]))
- mpv-unwrapped.dev
- ffmpeg
- ];
+ mpv = mpv-unwrapped.override {ffmpeg = ffmpeg-headless;};
in
- rustPlatform.buildRustPackage {
- inherit version src buildInputs;
+ rustPlatform.buildRustPackage (finalAttrs: {
+ inherit version;
pname = "yt";
+ src = fetchgit {
+ url = "https://git.foss-syndicate.org/bpeetz/clients/yt";
+ tag = "v${version}";
+ hash = "sha256-/Isgqe7Hda/1kwYY+ciQH/NBAcWvM92vDxWZ9svlQAM=";
+ };
+
+ cargoHash = "sha256-U0alYK9mhz6esVf0mad9o7Ra6tRaL9HKCOftyOg34HE=";
+
+ buildInputs = [
+ mpv.dev
+ ffmpeg-headless
+ openssl
+ libffi
+ zlib
+ curl.dev
+ python
+ deno
+ ];
+
nativeBuildInputs = [
+ installShellFiles
makeWrapper
sqlite
+ fd
+ pkg-config
+ mold
+ ];
+
+ checkInputs = [
+ # Needed for the tests in `libmpv2`
+ SDL2
];
passthru.updateScript = gitUpdater {rev-prefix = "v";};
@@ -42,32 +81,46 @@ in
lib.versions.major
llvmPackages_latest.clang-unwrapped.version;
in {
- FFMPEG_LOCATION = "${lib.getExe ffmpeg}";
- PYO3_PYTHON = lib.getExe (python3.withPackages (ps: [ps.yt-dlp]));
+ # Needed for the compile time sqlite checks.
+ DATABASE_URL = "sqlite://database.sqlx";
+
+ # Required by yt_dlp
+ FFMPEG_LOCATION = "${lib.getExe ffmpeg-headless}";
+ # Tell pyo3 which python to use.
+ PYO3_PYTHON = lib.getExe python;
+
+ # Needed for the libmpv2.
C_INCLUDE_PATH = "${glibc.dev}/include";
- DATABASE_URL = "sqlite://target/database.sqlite";
LIBCLANG_INCLUDE_PATH = "${llvmPackages_latest.clang-unwrapped.lib}/lib/clang/${clang_version}/include";
LIBCLANG_PATH = "${llvmPackages_latest.clang-unwrapped.lib}/lib/libclang.so";
};
- # Some tests depend on network access, others require a special library.
- doCheck = false;
+ doCheck = true;
+ checkFlags = [
+ # All of these tests try to connect to the internet to download test data.
+ "--skip=select::base::test_base"
+ "--skip=select::file::test_file"
+ "--skip=select::options::test_options"
+ "--skip=subscriptions::import_export::test_import_export"
+ "--skip=subscriptions::naming_subscriptions::test_naming_subscriptions"
+ "--skip=videos::downloading::test_downloading"
+ ];
prePatch = ''
- echo "$PATH"
+ # Generate the sqlite db, so that we can run the comp-time sqlite checks.
bash ./scripts/mkdb.sh
'';
- cargoHash = "sha256-QIAZb8twLxLm3TJOtb++pTWz98v49pt13auAEAeYFSk=";
-
- postBuild = ''
- install -m755 ./python_update/raw_update.py -D "$out/bin/raw_update.py"
- patchShebangs "$out/bin/raw_update.py"
- '';
-
postInstall = ''
+ installShellCompletion --cmd yt \
+ --bash <(COMPLETE=bash $out/bin/yt) \
+ --fish <(COMPLETE=fish $out/bin/yt) \
+ --zsh <(COMPLETE=zsh $out/bin/yt)
+
+ # NOTE: We cannot clear the path, because we need access to the $EDITOR. <2025-04-04>
wrapProgram $out/bin/yt \
- --prefix PATH : ${lib.makeBinPath buildInputs}:$out/bin
+ --prefix PATH : ${lib.makeBinPath finalAttrs.buildInputs} \
+ --set YTDLP_NO_PLUGINS 1
'';
- }
+ })
diff --git a/pkgs/by-name/yt/yti/package.nix b/pkgs/by-name/yt/yti/package.nix
deleted file mode 100644
index 5a39512a..00000000
--- a/pkgs/by-name/yt/yti/package.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- sysLib,
- gawk,
- expect,
- yt-dlp,
-}:
-sysLib.writeShellScript {
- name = "yti";
- src = ./yti.sh;
- generateCompletions = false;
- keepPath = false;
- dependencies = [
- gawk
- expect
- yt-dlp
- ];
-}
diff --git a/pkgs/by-name/yt/yti/yti.sh b/pkgs/by-name/yt/yti/yti.sh
deleted file mode 100755
index a69ffa74..00000000
--- a/pkgs/by-name/yt/yti/yti.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#! /usr/bin/env dash
-
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
-
-DOWN_DIR=/home/soispha/media/music/down/youtube
-
-tmp=$(mktmp)
-config=$(mktmp)
-
-for e in "$DOWN_DIR"/*.opus; do echo "$e" >>"$tmp"; done
-[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded"
-
-cat <<EO >"$config"
---paths home:"$DOWN_DIR"
-#--output %(fulltitle)
---restrict-filenames
---no-overwrites
---no-write-info-json
---clean-info-json
---prefer-free-formats
-#--format mp3
---extract-audio
---audio-quality 0
---audio-format best
-EO
-
-rm "$DOWN_DIR/yt-dlp.log"
-cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR"
-
-unbuffer yt-dlp --config-location "$config" "$1" | tee "$DOWN_DIR/yt-dlp.log"
-
-# vim: ft=sh