forked from RVC-Boss/GPT-SoVITS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
98 lines (93 loc) · 3.07 KB
/
flake.nix
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
description = "A Nix-flake-based Python development environment";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
nix-gl-host = {
url = "github:numtide/nix-gl-host";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nix-gl-host }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
inherit system;
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
permittedInsecurePackages = [
"python3.10-gradio-3.44.3"
];
};
};
});
in
{
devShells = forEachSupportedSystem ({ pkgs, system }: {
default = let pythonPkgs = pkgs.python310Packages; in pkgs.mkShell {
packages = with pythonPkgs; [ python-lsp-server ];
buildInputs = with pkgs; [ ffmpeg ] ++
(with pythonPkgs; [
torch
torchaudio
gradio
fastapi
numpy
scipy
tensorboard
librosa
numba
pytorch-lightning
ffmpeg-python
onnxruntime
tqdm
# funasr
# cn2an
pypinyin
# g2p_en
# modelscope
sentencepiece
transformers
chardet
# PyYAML
psutil
# jieba_fast
jieba
# LangSegment
# Faster_Whisper
# wordsegment
# This has to be built from source; otherwise, there will be glibc conflicts!
(buildPythonPackage rec {
pname = "pyopenjtalk";
version = "0.3.3";
# pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-Xr9GOLjCqzsqfXbQ28TWpkG8Uz93MxJNbelHjqffahk="; # pkgs.lib.fakeHash;
};
nativeBuildInputs = [ pkgs.cmake ];
# Have to skip configure, otherwise it will fails
configurePhase = ''
echo "Skip the configure phase"
'';
propagatedBuildInputs = [ setuptools numpy pip ];
doCheck = false;
# dependencies = [ numpy tqdm ];
})
]) ++
[ nix-gl-host.defaultPackage.${system} ];
shellHook = ''
export LD_LIBRARY_PATH="$(nixglhost -p):$LD_LIBRARY_PATH"
if [[ ! -d .venv ]]; then
echo "No virtual env found at ./.venv, creating a new virtual env linked to the Python site defined with Nix"
${pkgs.lib.getExe pkgs.python310} -m venv .venv --copies
fi
source .venv/bin/activate
echo "Nix development shell loaded."
'';
};
});
};
}