blob: ef218a36789f85e698f92242dd57cd4da0c68d98 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# yt - A fully featured command line YouTube client
#
# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Yt.
#
# 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>.
{
rustPlatform,
python3,
makeWrapper,
sqlite,
lib,
ffmpeg,
llvmPackages_latest,
glibc,
mpv-unwrapped,
}: let
version = "0.1.0";
src = ./.;
in
rustPlatform.buildRustPackage {
inherit version src;
pname = "yt";
nativeBuildInputs = [
makeWrapper
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
'';
cargoLock = {
lockFile = ./Cargo.lock;
};
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/
'';
}
|