From 30cc1d204bce56c438f84ad3035c2e9fa280ac81 Mon Sep 17 00:00:00 2001 From: w191923 Date: Mon, 9 Mar 2026 15:18:50 +0100 Subject: [PATCH] demucs-rs: init at 0.3.4 --- pkgs/by-name/de/demucs-rs/package.nix | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 pkgs/by-name/de/demucs-rs/package.nix diff --git a/pkgs/by-name/de/demucs-rs/package.nix b/pkgs/by-name/de/demucs-rs/package.nix new file mode 100644 index 000000000000..c6021386813b --- /dev/null +++ b/pkgs/by-name/de/demucs-rs/package.nix @@ -0,0 +1,60 @@ +{ + lib, + fetchFromGitHub, + rustPlatform, + pkg-config, + openssl, + vulkan-loader, + makeWrapper, + stdenv, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "demucs-rs"; + version = "0.3.4"; + + src = fetchFromGitHub { + owner = "nikhilunni"; + repo = "demucs-rs"; + tag = "v${finalAttrs.version}"; + hash = "sha256-IidfPS+/T8aJoW30gdnKhhsgluMt+h9RllAXH9Yrq1g="; + }; + + cargoHash = "sha256-xngHyenlB3sMqzJHNk9utk4TNhdt+awutDuP1JzhhBA="; + + # Only build the CLI crate, not the DAW plugin or WASM targets + buildAndTestSubdir = "demucs-cli"; + + nativeBuildInputs = [ + pkg-config + makeWrapper + ]; + + buildInputs = [ + openssl + ]; + + # wgpu dlopen()s libvulkan at runtime, so LD_LIBRARY_PATH is needed (RPATH has no effect). + # this is Linux-only: on Darwin wgpu uses Metal and should need no runtime patching. + postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' + wrapProgram $out/bin/demucs \ + --prefix LD_LIBRARY_PATH : "${vulkan-loader}/lib" + ''; + + meta = { + description = "Native Rust implementation of HTDemucs v4 music source separation CLI"; + longDescription = '' + A native Rust implementation of HTDemucs v4 — state-of-the-art music + source separation. Splits any song into individual stems (drums, bass, + vocals, etc.) using GPU-accelerated inference via Burn. + + Model weights are downloaded automatically from Hugging Face on first + use and cached for future runs. + ''; + homepage = "https://github.com/nikhilunni/demucs-rs"; + license = lib.licenses.asl20; + mainProgram = "demucs"; + maintainers = with lib.maintainers; [ eymeric ]; + platforms = lib.platforms.unix; + }; +})