Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Linux Voice Activated Macros
* [Install](#install)
* [Available packages](#available-packages)
* [AUR](#aur)
* [Nix flake](#nix-flake)
* [NixOS](#nixos)
* [Other distros](#other-distros)
* [Install manually](#install-manually)
* [Requirements](#requirements)
* [Installation steps](#installation-steps)
Expand Down Expand Up @@ -53,6 +56,35 @@ If a package is available for your distribution, that's the recommended way for

After installing from AUR, run ``sudo usermod -aG tty,input $USER`` to allow [uinput access without sudo](#udev-rule-for-input) and restart your PC.

### Nix flake
You will need ``nix-command`` and ``flakes`` enabled, as well your user being in groups ``input`` and ``tty``

Follow the steps below to configure those things for your distro. Once configured, clone this repo, enter it with ``cd LinVAM`` and run ``nix run .`` to use the application.

#### NixOS
Set the following in your ``configuration.nix``
```
# Replace john with your username

users.users.john.extraGroups = [
"input"
"tty"
];

nix.settings.experimental-features = [
"nix-command"
"flakes"
];
```

#### Other distros
You can use Nix on nearly any Linux distro, but this section will not explicitly cover how to get Nix itself up and running. There are plenty of good guides out there though (like [this one](https://nix.dev/manual/nix/2.28/installation/index.html)).

Once Nix is working, run ``sudo usermod -aG input,tty $USER`` and put the following in ``$XDG_CONFIG_HOME/nix/nix.conf``
```
experimental-features = nix-command flakes
```

### Install manually

#### Requirements
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 120 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# flake.nix - Nix flake for building and running LinVAM
# Includes Vosk via prebuilt wheel (x86_64-linux only)

{
description = "LinVAM - Linux Voice Activated Macros";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};

python = pkgs.python3;

voskWheel = pkgs.fetchurl {
url = "https://files.pythonhosted.org/packages/py3/v/vosk/vosk-0.3.45-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl";
hash = "sha256-JeAlCTxDmdcnj1Q1aO2MxUYKw6S/SMI2c6zh4l0mYZ8=";
};

vosk = python.pkgs.buildPythonPackage rec {
pname = "vosk";
version = "0.3.45";
format = "wheel";

src = voskWheel;

propagatedBuildInputs = [ ];
doCheck = false;

meta = with pkgs.lib; {
description = "Vosk offline speech recognition toolkit";
homepage = "https://alphacephei.com/vosk/";
license = licenses.asl20;
platforms = [ "x86_64-linux" ];
};
};

pythonEnv = python.withPackages (ps: with ps; [
pyqt6
sounddevice
srt
requests
tqdm
setuptools
vosk
]);
in
rec {
formatter = pkgs.nixpkgs-fmt;

packages.default = pkgs.python3Packages.buildPythonApplication {
pname = "linvam";
version = "0.8.4"; # Bump on new releases; matches latest tag v0.8.4

src = self;

pyproject = true;
build-system = [ pkgs.python3Packages.setuptools ];

propagatedBuildInputs = with pkgs.python3Packages; [
pyqt6
sounddevice
srt
requests
tqdm
setuptools
vosk
];

nativeBuildInputs = [
pkgs.makeWrapper
pkgs.ffmpeg
pkgs.ydotool
];

installPhase = ''
runHook preInstall
${python.interpreter} setup.py install --prefix=$out --no-compile
runHook postInstall
'';

postFixup = ''
wrapProgram $out/bin/linvam \
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.ffmpeg pkgs.ydotool ]}
'';

meta = with pkgs.lib; {
description = "Linux Voice Activated Macros";
homepage = "https://github.com/stele95/LinVAM";
license = licenses.gpl3Only;
platforms = [ "x86_64-linux" ];
mainProgram = "linvam";
};
};

devShells.default = pkgs.mkShell {
packages = [
pythonEnv
pkgs.ffmpeg
pkgs.ydotool
];

shellHook = ''
echo "LinVAM dev environment ready with Vosk included."
echo "Run 'linvam' to test."
'';
};

apps.default = {
type = "app";
program = "${packages.default}/bin/linvam";
};
}
);
}