diff --git a/pkgs/development/python-modules/anki-audio/default.nix b/pkgs/development/python-modules/anki-audio/default.nix new file mode 100644 index 000000000000..05badedf8001 --- /dev/null +++ b/pkgs/development/python-modules/anki-audio/default.nix @@ -0,0 +1,53 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + stdenv, + hatchling, + mpv-unwrapped, + lame, +}: + +buildPythonPackage (finalAttrs: { + pname = "anki-audio"; + version = "0.1.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ankitects"; + repo = "anki-bundle-extras"; + rev = "e83c6e64dcb110ed579fc78afbb4e72bed8fb9e9"; + hash = "sha256-iOAZ7EytEVpvsrnVFk6bkiU8FWf2Q7tTzJjawZQCW6E="; + }; + + build-system = [ hatchling ]; + + env = { + ANKI_AUDIO_TARGET_OS = "darwin"; + ANKI_AUDIO_TARGET_ARCH = stdenv.hostPlatform.darwinArch; + }; + + preBuild = + let + archDir = if stdenv.hostPlatform.isAarch64 then "arm64" else "amd64"; + in + '' + mkdir -p mac/${archDir}/dist/audio/Resources + ln -s ${lib.getExe mpv-unwrapped} ${lib.getExe lame} mac/${archDir}/dist/audio/Resources/ + ''; + + pythonImportsCheck = [ "anki_audio" ]; + + meta = { + description = "Audio binaries (mpv, lame) for Anki"; + homepage = "https://github.com/ankitects/anki-bundle-extras"; + sourceProvenance = with lib.sourceTypes; [ fromSource ]; + platforms = lib.platforms.darwin; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ + euank + junestepp + oxij + ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ef4b99013cf6..93ab040a9b82 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -758,6 +758,8 @@ self: super: with self; { anitopy = callPackage ../development/python-modules/anitopy { }; + anki-audio = callPackage ../development/python-modules/anki-audio { }; + anndata = callPackage ../development/python-modules/anndata { }; annexremote = callPackage ../development/python-modules/annexremote { };