Skip to content

feat(nix): add official Nix/NixOS support with auto-update workflow#246

Open
realitymolder wants to merge 1 commit into
crynta:mainfrom
realitymolder:nix-support
Open

feat(nix): add official Nix/NixOS support with auto-update workflow#246
realitymolder wants to merge 1 commit into
crynta:mainfrom
realitymolder:nix-support

Conversation

@realitymolder
Copy link
Copy Markdown

Add a flake + nix/package.nix derivation building Terax for x86_64-linux, x86_64-darwin, and aarch64-darwin, with nixosModules and darwinModules for easy system integration.

Extract version and SRI hashes into nix/sources.json consumed by the derivation via builtins.fromJSON, and add a GitHub Actions workflow triggered on release published that downloads assets, computes SRI hashes, and opens a PR bumping sources.json automatically.

What

Add official Nix/NixOS support via a flake + nix/package.nix derivation, and a release workflow to keep the Nix sources up to date automatically.

  • flake.nix / nix/package.nix — builds Terax for x86_64-linux, x86_64-darwin, aarch64-darwin; includes nixosModules and darwinModules for easy system integration
  • nix/sources.json — standalone version/hashes file consumed by the derivation
  • .github/workflows/update-nix-sources.yml — triggers on release published, downloads assets, computes SRI hashes, and opens a PR bumping sources.json

Why

Nix was not previously supported as an installation method. Manual bumping of version + three hashes on every release is also error-prone — the workflow automates it.

How

builtins.fromJSON (builtins.readFile ./sources.json) loads version and per-platform hashes. The release workflow uses openssl dgst -sha256 -binary + base64 to produce SRI hashes matching Nix's sha256-... format. The flake provides packages.terax, nixosModules.terax, and darwinModules.terax.

Testing

  • nix build .#terax succeeds on Linux and macOS
  • nix/package.nix parses correctly — builtins.fromJSON reads the file at evaluation time
  • Workflow syntax validated against peter-evans/create-pull-request@v7
  • README updated with Nix install instructions pointing to the official flake

Notes for reviewer

First-class Nix support for the project — the flake is the canonical way to install on NixOS.

Add a flake + nix/package.nix derivation building Terax for x86_64-linux,
x86_64-darwin, and aarch64-darwin, with nixosModules and darwinModules
for easy system integration.

Extract version and SRI hashes into nix/sources.json consumed by the
derivation via builtins.fromJSON, and add a GitHub Actions workflow
triggered on release published that downloads assets, computes SRI
hashes, and opens a PR bumping sources.json automatically.
@realitymolder realitymolder requested a review from crynta as a code owner May 14, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant