aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/yt/yt/package.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/yt/yt/package.nix117
1 files changed, 87 insertions, 30 deletions
diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix
index 3c780374..41234e19 100644
--- a/pkgs/by-name/yt/yt/package.nix
+++ b/pkgs/by-name/yt/yt/package.nix
@@ -1,39 +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,
fd,
+ pkg-config,
+ SDL2,
}: let
- version = "1.5.0";
-
- src = fetchgit {
- url = "https://git.foss-syndicate.org/bpeetz/clients/yt";
- rev = "v${version}";
- hash = "sha256-P/mpF2KPjoC7XZ6juJubeGEHhL2ajdOeiuIEb5sYrS0=";
- };
+ version = "1.9.0";
+ python = python3.withPackages (ps: [ps.yt-dlp]);
- buildInputs = [
- (python3.withPackages (ps: [ps.yt-dlp]))
- 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";};
@@ -43,27 +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.sqlx";
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 = ''
+ # Generate the sqlite db, so that we can run the comp-time sqlite checks.
bash ./scripts/mkdb.sh
'';
- useFetchCargoVendor = true;
- cargoHash = "sha256-0XTbC+mFsczUFXqAtiQ+BIsCfKilerhlzE41pzVjLVs=";
-
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}
+ --prefix PATH : ${lib.makeBinPath finalAttrs.buildInputs} \
+ --set YTDLP_NO_PLUGINS 1
'';
- }
+ })