Files
voculinux/packaging/nix
c3c390f19d feat(nix): add flake package, NixOS and Home Manager modules (#936)
* feat(nix): add flake package, NixOS and Home Manager modules

Add a flake.nix plus packaging/nix derivations so Nix and NixOS users can
run and install Vocalinux declaratively, including via Home Manager.

- package.nix: buildPythonApplication with GTK3, libayatana-appindicator,
  IBus and libnotify typelibs; wraps the entry point with every host tool
  the injectors probe for (xdotool, wtype, ydotool, wl-clipboard, xclip,
  xsel, xprop, setxkbmap, ibus, gdbus, notify-send, paplay, aplay)
- pywhispercpp.nix: builds pywhispercpp from its vendored PyPI sdist
  (absent from nixpkgs, same gap as Debian/Fedora), static whisper.cpp,
  GGML_NATIVE=OFF for a portable baseline
- module.nix: NixOS module enabling hardware.uinput and installing the
  package; input/uinput group membership stays a per-user choice
- home-manager.nix: programs.vocalinux.enable installs into the profile
- docs/INSTALL.md gains a Nix / NixOS section; packaging/nix/README.md
  carries the usage snippets

Refs #931

* fix(nix): address review findings on imports check and docs

- pywhispercpp: check pywhispercpp.model and _pywhispercpp too, so the
  compiled binding is proven loadable, not just the package
- README Home Manager example: declare the nixpkgs/home-manager inputs
  and pass pkgs, which homeManagerConfiguration requires
- package.nix: use top-level xprop/setxkbmap attrs (xorg.* is deprecated)

---------

Co-authored-by: Jatin K Malik <jatinkrmalik@gmail.com>
2026-10-10 20:40:25 -07:00
..

Vocalinux for Nix

A flake that builds Vocalinux against nixpkgs: GTK 3, PyGObject and the AppIndicator typelib come from nixpkgs, and pywhispercpp — which nixpkgs does not package — is built from its PyPI sdist (it vendors whisper.cpp and pybind11). Every host tool the app probes for (xdotool, wtype, ydotool, wl-clipboard, xclip, xsel, xprop, setxkbmap, ibus, gdbus, notify-send, paplay, aplay) is wired onto PATH, so the wrapped binary behaves like a deb/rpm install with Recommends present.

Try it

nix run github:VocaHQ/vocalinux

or install into a profile:

nix profile install github:VocaHQ/vocalinux

NixOS

{
  inputs.vocalinux.url = "github:VocaHQ/vocalinux";

  outputs = { nixpkgs, vocalinux, ... }: {
    nixosConfigurations.host = nixpkgs.lib.nixosSystem {
      modules = [
        vocalinux.nixosModules.vocalinux
        {
          programs.vocalinux.enable = true;
          users.users.you.extraGroups = [ "input" "uinput" ];
        }
      ];
    };
  };
}

hardware.uinput (enabled by the module) covers /dev/uinput, which ydotool and the evdev backend's keyboard clone need. input group membership is a per-user decision — it grants read access to every keyboard and pointer device, the same trade-off install.sh documents. X11 sessions need neither and can skip the group lines entirely.

Home Manager

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.home-manager.url = "github:nix-community/home-manager";
  inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
  inputs.vocalinux.url = "github:VocaHQ/vocalinux";

  outputs = { nixpkgs, home-manager, vocalinux, ... }: {
    homeConfigurations.you = home-manager.lib.homeManagerConfiguration {
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
      modules = [
        vocalinux.homeManagerModules.vocalinux
        { programs.vocalinux.enable = true; }
      ];
    };
  };
}

Home Manager on NixOS still needs the system-side pieces above (the NixOS module handles hardware.uinput; group membership stays per-user). On a non-NixOS host, nix profile install plus the equivalent udev rule and group membership from your distro does the same job — see docs/INSTALL.md.

Scope

  • Default engine whisper.cpp plus the [vad] extra (ONNX Runtime) are built in. The vosk, whisper, parakeet and faster_whisper extras are not packaged (PyTorch footprint / not in nixpkgs).
  • pywhispercpp is built with GGML_NATIVE=OFF — a portable baseline rather than -march=native, so binaries can move between machines.