2026-10-24 10:37:46 +02:00
|
|
|
{
|
2026-10-24 11:15:35 +02:00
|
|
|
# talk: voice notifications for scripts and AI agents.
|
2026-10-24 10:37:46 +02:00
|
|
|
#
|
2026-10-24 11:15:35 +02:00
|
|
|
# Usage in a NixOS / Home Manager configuration:
|
2026-10-24 10:37:46 +02:00
|
|
|
# inputs.talk.url = "git+https://code.m3ta.dev/m3tam3re/talk";
|
|
|
|
|
# environment.systemPackages = [ inputs.talk.packages.${system}.talk ];
|
2026-10-24 11:15:35 +02:00
|
|
|
# or as an overlay: nixpkgs.overlays = [ inputs.talk.overlays.default ];
|
2026-10-24 10:37:46 +02:00
|
|
|
#
|
2026-10-24 11:15:35 +02:00
|
|
|
# In the long run this flake replaces m3ta-nixpkgs talk/crunch (bash + mpv).
|
|
|
|
|
description = "talk: voice notifications for scripts and AI agents (one binary, daemon with queue)";
|
2026-10-24 10:37:46 +02:00
|
|
|
|
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs }:
|
|
|
|
|
let
|
|
|
|
|
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
|
|
|
|
forAll = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
|
|
|
|
version = if self ? shortRev then "0.0.0-${self.shortRev}" else "0.0.0-dirty";
|
|
|
|
|
mkTalk = pkgs: pkgs.buildGoModule {
|
|
|
|
|
pname = "talk";
|
|
|
|
|
inherit version;
|
|
|
|
|
src = self;
|
|
|
|
|
subPackages = [ "cmd/talk" ];
|
2026-10-24 11:15:35 +02:00
|
|
|
# Update after changes to go.mod/go.sum: `nix build` prints the
|
|
|
|
|
# expected hash.
|
2026-10-24 12:10:49 +02:00
|
|
|
vendorHash = "sha256-Cne8FiMlpsrFfntMJVtV4D3CzEWQ4Jnd+tIEHF9ecEc=";
|
2026-10-24 10:37:46 +02:00
|
|
|
env.CGO_ENABLED = 0;
|
|
|
|
|
ldflags = [ "-s" "-w" "-X" "main.version=${version}" "-X" "main.commit=${self.shortRev or "dirty"}" ];
|
2026-10-24 11:15:35 +02:00
|
|
|
# The process-boundary tests start daemons and bind ports; not in the sandbox.
|
2026-10-24 10:37:46 +02:00
|
|
|
doCheck = false;
|
2026-10-24 11:15:35 +02:00
|
|
|
# Audio: oto talks to PulseAudio/PipeWire directly (pure Go) and falls
|
|
|
|
|
# back to ALSA, which it loads at runtime via dlopen; on NixOS that is
|
|
|
|
|
# only found if we put it on the path. OS voice: espeak-ng.
|
2026-10-24 10:37:46 +02:00
|
|
|
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.makeWrapper ];
|
|
|
|
|
postInstall = pkgs.lib.optionalString pkgs.stdenv.isLinux ''
|
|
|
|
|
wrapProgram $out/bin/talk \
|
|
|
|
|
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath [ pkgs.alsa-lib ]} \
|
|
|
|
|
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.espeak-ng pkgs.libnotify ]}
|
|
|
|
|
'';
|
|
|
|
|
meta = with pkgs.lib; {
|
2026-10-24 11:15:35 +02:00
|
|
|
description = "Voice notifications for scripts and AI agents";
|
2026-10-24 10:37:46 +02:00
|
|
|
homepage = "https://code.m3ta.dev/m3tam3re/talk";
|
|
|
|
|
license = licenses.mit;
|
|
|
|
|
mainProgram = "talk";
|
|
|
|
|
platforms = platforms.unix;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
packages = forAll (pkgs: rec {
|
|
|
|
|
talk = mkTalk pkgs;
|
|
|
|
|
default = talk;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
apps = forAll (pkgs: rec {
|
|
|
|
|
talk = { type = "app"; program = "${mkTalk pkgs}/bin/talk"; };
|
|
|
|
|
default = talk;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
overlays.default = final: prev: { talk = mkTalk final; };
|
|
|
|
|
|
|
|
|
|
devShells = forAll (pkgs: {
|
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
|
packages = [ pkgs.go pkgs.gopls pkgs.gotools pkgs.espeak-ng pkgs.libnotify ];
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
formatter = forAll (pkgs: pkgs.nixfmt-rfc-style);
|
|
|
|
|
};
|
|
|
|
|
}
|