NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.37k stars 14.32k forks source link

Package request: python3Packages.rvc-cli #359116

Open hakan-demirli opened 4 days ago

hakan-demirli commented 4 days ago

Project description

An easy-to-use CLI Voice Conversion framework.

Metadata


Note for maintainers: Please tag this issue in your PR.


Add a :+1: reaction to issues you find important.

hakan-demirli commented 4 days ago

Depends on: https://github.com/NixOS/nixpkgs/issues/351989 https://github.com/NixOS/nixpkgs/issues/359108 and https://github.com/NixOS/nixpkgs/issues/351988

hakan-demirli commented 4 days ago

Following flake environment works:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixpkgs-unstable";
  };

  outputs =
    {
      self,
      nixpkgs,
      ...
    }@inputs:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config.allowUnfree = true;
        #Didn't test this to spare my poor CPU
        #config.cudaSupport = true;
      };
      pedalboard = pkgs.callPackage ./nix/pedalboard.nix { };
      noisereduce = pkgs.callPackage ./nix/noisereduce.nix { };
      local-attention = pkgs.callPackage ./nix/local-attention.nix { };
    in
    {
      devShells.${system}.default =
        let
          pythonEnv = pkgs.python3.withPackages (
            ps: with ps; [
              pip
              distutils

              # Core dependencies
              numpy
              requests
              tqdm
              wget
              pydantic
              fastapi
              starlette

              # Audio processing
              ffmpeg-python
              faiss
              librosa
              pyworld
              scipy
              soundfile
              # praat-parselmouth
              parselmouth
              noisereduce
              pedalboard
              # stftpitchshift

              # Machine learning and deep learning
              numba
              torch
              torchaudio
              torchvision
              torchcrepe
              einops
              # libf0
              transformers

              # Visualization and UI
              matplotlib
              tensorboard
              gradio

              # Miscellaneous utilities
              certifi
              antlr4-python3-runtime
              ffmpy
              tensorboardx
              # edge-tts
              pypresence
              beautifulsoup4
              flask
              local-attention

              # UVR
              samplerate
              six
              pydub
              onnx
              # onnx2torch
              onnxruntime
              julius
              # diffq
              # ml_collections
              resampy
              beartype
              rotary-embedding-torch
            ]
          );
        in
        pkgs.mkShell {
          packages = [ pythonEnv ];
        };
    };
}
hakan-demirli commented 3 days ago

Derivation:

{
  pkgs,
  fetchFromGitHub,
}:

let
  pedalboard = pkgs.callPackage ./pedalboard.nix { };
  noisereduce = pkgs.callPackage ./noisereduce.nix { };
  local-attention = pkgs.callPackage ./local-attention.nix { };
in
pkgs.stdenv.mkDerivation rec {
  pname = "rvc-cli";
  version = "1.0";

  src = fetchFromGitHub {
    owner = "blaisewf";
    repo = "rvc-cli";
    rev = "3c0424dad3d2cca98c6e02d217a0a3cc4632619d";
    sha256 = "sha256-lnxq+nDB0ikT2v6jEWWiH4P54Gl3FH065IKybjJLa38=";
  };

  # Custom install phase to wrap the `rvc_cli.py` script
  installPhase = ''
        mkdir -p $out/bin
        cat <<EOF > $out/bin/rvc_cli
    #!/usr/bin/env bash
    export PYTHONPATH=$PYTHONPATH:${src}
    exec ${pkgs.python3Packages.python.interpreter} ${src}/rvc_cli.py "\$@"
    EOF
        chmod +x $out/bin/rvc_cli
  '';

  # Dependencies for your Python application
  propagatedBuildInputs = with pkgs.python3Packages; [
    distutils
    numpy
    requests
    tqdm
    wget
    pydantic
    fastapi
    starlette
    ffmpeg-python
    faiss
    librosa
    pyworld
    scipy
    soundfile
    parselmouth
    numba
    torch
    torchaudio
    torchvision
    torchcrepe
    einops
    transformers
    matplotlib
    tensorboard
    gradio
    certifi
    antlr4-python3-runtime
    ffmpy
    tensorboardx
    pypresence
    beautifulsoup4
    flask
    samplerate
    six
    pydub
    onnx
    onnxruntime
    julius
    resampy
    beartype
    rotary-embedding-torch
    pedalboard
    noisereduce
    local-attention
  ];
}