{ lib, stdenv, buildGoModule, fetchFromGitea, makeWrapper, alsa-lib, espeak-ng, libnotify, nix-update-script, versionCheckHook, }: buildGoModule (finalAttrs: { pname = "talk"; version = "0.1.2"; src = fetchFromGitea { domain = "code.m3ta.dev"; owner = "m3tam3re"; repo = "talk"; tag = "v${finalAttrs.version}"; hash = "sha256-2goEKz/oMB/mfQpAiED+6iiAhCpOH9BbQlzsuFMjiYk="; }; vendorHash = "sha256-8B1ubNy4sap3XV83lX93NvpH3z4BNloWgkM7OB4hglo="; subPackages = ["cmd/talk"]; env.CGO_ENABLED = 0; ldflags = [ "-s" "-w" "-X" "main.version=${finalAttrs.version}" ]; # The process-boundary tests start daemons and bind ports; not in the sandbox. doCheck = false; # oto talks to PulseAudio/PipeWire directly and falls back to ALSA via # dlopen; espeak-ng is the OS voice, libnotify the toast. nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [makeWrapper]; postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' wrapProgram $out/bin/talk \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [alsa-lib]} \ --prefix PATH : ${lib.makeBinPath [espeak-ng libnotify]} ''; nativeInstallCheckInputs = [versionCheckHook]; versionCheckProgramArg = "version"; doInstallCheck = true; passthru.updateScript = nix-update-script {}; meta = with lib; { description = "Voice notifications for scripts and AI agents"; homepage = "https://code.m3ta.dev/m3tam3re/talk"; license = licenses.mit; mainProgram = "talk"; platforms = platforms.unix; }; })