diff options
Diffstat (limited to 'pkgs/by-name/yt/yt/package.nix')
-rw-r--r-- | pkgs/by-name/yt/yt/package.nix | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix index b89deddb..35b5e2ea 100644 --- a/pkgs/by-name/yt/yt/package.nix +++ b/pkgs/by-name/yt/yt/package.nix @@ -1,44 +1,65 @@ { - lib, - makeWrapper, rustPlatform, - # dependencies - ytcc, - yt-dlp, - mpv, -}: { - yt = import ./yt.nix { - inherit - lib - makeWrapper - rustPlatform - # dependencies - - ytcc - yt-dlp - mpv - ; - }; - yts = import ./yts.nix { - inherit - lib - makeWrapper - rustPlatform - # dependencies - - ytcc - ; + python3, + makeWrapper, + fetchgit, + sqlite, + lib, + ffmpeg, + llvmPackages_latest, + glibc, + mpv-unwrapped, +}: let + version = "0.1.1"; + + src = fetchgit { + url = "https://git.vhack.eu/soispha/clients/yt"; + rev = "v${version}"; + hash = "sha256-glaGJ9E4myuSL1Q01Ll6YFfuWgzJwz+xavmmk6PKp80="; }; - ytc = import ./ytc.nix { - inherit - lib +in + rustPlatform.buildRustPackage { + inherit version src; + pname = "yt"; + + nativeBuildInputs = [ makeWrapper - rustPlatform - # dependencies - - ytcc - yt-dlp - mpv - ; - }; -} + sqlite + ]; + + buildInputs = [ + (python3.withPackages (ps: [ps.yt-dlp])) + mpv-unwrapped.dev + ]; + + env = let + clang_version = + lib.versions.major + llvmPackages_latest.clang-unwrapped.version; + in { + FFMPEG_LOCATION = "${lib.getExe ffmpeg}"; + LIBCLANG_PATH = "${llvmPackages_latest.clang-unwrapped.lib}/lib/libclang.so"; + LIBCLANG_INCLUDE_PATH = "${llvmPackages_latest.clang-unwrapped.lib}/lib/clang/${clang_version}/include"; + C_INCLUDE_PATH = "${glibc.dev}/include"; + + PYO3_PYTHON = lib.getExe (python3.withPackages (ps: [ps.yt-dlp])); + DATABASE_URL = "sqlite://target/database.sqlite"; + }; + + prePatch = '' + echo "$PATH" + bash ./scripts/mkdb.sh + ''; + + cargoHash = "sha256-s3kbrIIhxqqogbiAathyKXI4SyZV3bIpMqXfk5nnVZo="; + + postBuild = '' + install -m755 ./python_update/raw_update.py -D "$out/bin/raw_update.py" + patchShebangs "$out/bin/raw_update.py" + ''; + + postInstall = '' + wrapProgram $out/bin/yt \ + --prefix PATH : $out/bin/ + ''; + } |