pdf-speak/flake.nix

44 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2024-05-04 16:58:14 +02:00
{
description = "A simple flake";
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
python = pkgs.python311;
pythonPackages = python.pkgs;
modelUrl = "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx?download=true";
modelJsonUrl = "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx.json?download=true.json";
model = pkgs.fetchurl {
name = "hfc_female/medium/en_US-hfc_female-medium.onnx";
url = modelUrl;
sha256 = "sha256-kUxHN4j8H6i2Os4c3NtEWI9K5SPTqzffFTZhaDWhQLc="; # replace with the correct sha256
};
modelJson = pkgs.fetchurl {
name = "hfc_female/medium/en_US-hfc_female-medium.onnx.json";
url = modelJsonUrl;
sha256 = "sha256-A/H6BiK4BGMoNZLZesqfbomuw0WlxWtyV3I+AJPFi2w="; # replace with the correct sha256
};
in pkgs.mkShell {
nativeBuildInputs = with pkgs; [
python
piper-tts
alsa-utils # for aplay for piper-tts to stream to
(pythonPackages.pypdf)
];
shellHook = ''
mkdir -p piper-models
cp ${model} piper-models/
cp ${modelJson} piper-models/
'';
};
};
}