Handy/flake.nix
Sami Ansari 6827fb51d4
Add Nix flake for NixOS support (#561)
* Add Nix flake for NixOS support

Provides:
- handy-appimage: AppImage-based package (default)
- devShell: Development environment for building from source

* fix(nix): address PR feedback for flake.nix

- Remove aarch64-linux from supportedSystems (ARM64 builds not produced)
- Read version dynamically from Cargo.toml instead of hardcoding
  This enables automated updates during GitHub releases

* chore(nix): add GitHub Actions workflow to auto-update AppImage hash

Adds a separate workflow triggered on release publication that:
- Fetches the released AppImage
- Computes the SRI hash using nix-prefetch-url
- Updates flake.nix with the new hash
- Commits and pushes changes directly

Includes retry logic for timing issues and defensive checks to verify
the hash was actually updated and skip commits if unchanged.

* Update flake.nix hash to resolve mismatch

Co-authored-by: pinage404 <pinage404@gmail.com>

* Update flake.nix to install dependencies automatically

Co-authored-by: pinage404 <pinage404@gmail.com>

* fix: update AppImage hash for v0.7.0

* modified description

---------

Co-authored-by: pinage404 <pinage404@gmail.com>
Co-authored-by: CJ Pais <cj@cjpais.com>
2026-02-01 10:32:49 +08:00

78 lines
2.1 KiB
Nix

{
description = "Handy - A free, open source, and extensible speech-to-text application that works completely offline";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Read version from Cargo.toml
cargoToml = builtins.fromTOML (builtins.readFile ./src-tauri/Cargo.toml);
version = cargoToml.package.version;
in {
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
# AppImage-based package
handy-appimage = let
appimage = pkgs.appimageTools.wrapType2 {
pname = "handy-appimage-unwrapped";
inherit version;
src = pkgs.fetchurl {
url = "https://github.com/cjpais/Handy/releases/download/v${version}/Handy_${version}_amd64.AppImage";
hash = "sha256-tTswFYLCPGtMbHAb2bQMsklRiRCVXLrtu4pQC8IHdqQ=";
};
extraPkgs = p:
with p; [
alsa-lib
];
};
in
pkgs.writeShellScriptBin "handy" ''
export WEBKIT_DISABLE_DMABUF_RENDERER=1
exec ${appimage}/bin/handy-appimage-unwrapped "$@"
'';
default = self.packages.${system}.handy-appimage;
});
# Development shell for building from source
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
# Rust
rustc
cargo
rust-analyzer
clippy
# Frontend
nodejs
bun
# Native deps
pkg-config
openssl
alsa-lib
libsoup_3
webkitgtk_4_1
gtk3
glib
# Tauri CLI
cargo-tauri
];
shellHook = ''
echo "Handy development environment"
bun install
echo "Run 'bun run tauri dev' to start"
'';
};
});
};
}