about summary refs log tree commit diff stats
path: root/package.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-21 17:52:12 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-21 17:53:27 +0200
commit54ad8cdafba9ac3e054bb12e26a025ae2fb088e8 (patch)
tree20eef72a6934d63df0cfa5aab141a0f010530b73 /package.nix
parentchore(version): v0.1.1 (diff)
downloadyt-54ad8cdafba9ac3e054bb12e26a025ae2fb088e8.tar.gz
yt-54ad8cdafba9ac3e054bb12e26a025ae2fb088e8.zip
build(flake): Wrap the yt binary with the required dependencies
Diffstat (limited to 'package.nix')
-rw-r--r--package.nix23
1 files changed, 12 insertions, 11 deletions
diff --git a/package.nix b/package.nix
index ef218a3..54ee6c1 100644
--- a/package.nix
+++ b/package.nix
@@ -21,9 +21,15 @@
   version = "0.1.0";
 
   src = ./.;
+
+  buildInputs = [
+    (python3.withPackages (ps: [ps.yt-dlp]))
+    mpv-unwrapped.dev
+    ffmpeg
+  ];
 in
   rustPlatform.buildRustPackage {
-    inherit version src;
+    inherit version src buildInputs;
     pname = "yt";
 
     nativeBuildInputs = [
@@ -31,23 +37,18 @@ in
       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]));
+
+      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";
     };
 
     prePatch = ''
@@ -66,6 +67,6 @@ in
 
     postInstall = ''
       wrapProgram $out/bin/yt \
-        --prefix PATH : $out/bin/
+        --prefix PATH : ${lib.makeBinPath buildInputs}:$out/bin
     '';
   }