Handy/nix/hm-module.nix
COGnITO (mode: carbon) cf284b1700
feat(nix): NixOS integration — ALSA_PLUGIN_DIR, nixosModule, home-manager module (#1025)
- Set ALSA_PLUGIN_DIR to PipeWire's alsa-lib path in package wrapper
  (NixOS store paths aren't in ALSA's default plugin search)
- Add nixosModules.default: udev rule for /dev/uinput, systemPackages
- Add homeManagerModules.default: systemd user service for autostart

Co-authored-by: zitongcharliedeng <zitongcharliedeng@users.noreply.github.com>
2026-03-16 20:47:32 +08:00

41 lines
1,007 B
Nix

# Home-manager module for Handy speech-to-text
#
# Provides a systemd user service for autostart.
# Usage: imports = [ handy.homeManagerModules.default ];
# services.handy.enable = true;
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.handy;
in
{
options.services.handy = {
enable = lib.mkEnableOption "Handy speech-to-text user service";
package = lib.mkOption {
type = lib.types.package;
defaultText = lib.literalExpression "handy.packages.\${system}.handy";
description = "The Handy package to use.";
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.handy = {
Unit = {
Description = "Handy speech-to-text";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${cfg.package}/bin/handy";
Restart = "on-failure";
RestartSec = 5;
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
}