Skip to content

feat(dist): Nix flake module + service + cachix + FlakeHub (#1235) - #1336

Merged
Sinity merged 1 commit into
masterfrom
feature/dist/nix-flake-module-1235
May 18, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/dist/nix-flake-module-1235

Conversation

@Sinity

@Sinity Sinity commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Expose polylogue as a fully external-consumable Nix flake: nix run github:Sinity/polylogue#<app> works without a checkout, a Home Manager
module wires the user-mode daemon, the polylogue cachix cache is
populated on every master push and tag, and the flake is published to
FlakeHub on tag push.

Closes #1235. Ref #953.

Problem

The existing flake builds the polylogue package and exposes a
devshell, and nix/module.nix declares a NixOS module. But none of the
external-consumer paths actually worked:

  • nix run github:Sinity/polylogue#polylogued failed: the flake did
    not declare any apps.<system>.* outputs, only packages. nix run
    fell back to the default package's meta.mainProgram, so the
    alternate entrypoints (polylogued, polylogue-mcp) were not
    addressable by name.
  • No Home Manager module existed, so non-NixOS users on home-manager
    could not declaratively enable a per-user polylogued unit.
  • Every fresh consumer rebuilt the dependency closure from source; no
    binary cache was published.
  • The flake was undiscoverable outside niche Nix circles.

Solution

  • flake.nix: add
    apps.x86_64-linux.{polylogue,polylogued,polylogue-mcp,default}
    pointing at the wrapped entrypoints under
    polylogue/bin/. Expose homeManagerModules.{default,polylogue}
    alongside the existing nixosModules.{default,polylogue}.
  • nix/hm-module.nix (new): Home Manager module that mirrors
    nix/module.nix settings shape (archive, daemon, daemon-api,
    browser-capture, embedding, logging) and wires
    systemd.user.services.polylogued. programs.polylogued.autoStart
    defaults to true (WantedBy=default.target); set false to keep
    the unit available but not started at login.
  • .github/workflows/cachix.yml (new): on master pushes and vX.Y.Z
    tags, build polylogue, api-python, and the devshell closure and
    push them to the polylogue cachix cache. Requires
    CACHIX_AUTH_TOKEN repository secret.
  • .github/workflows/flakehub.yml (new): publish the flake to
    FlakeHub on vX.Y.Z tag push, with a workflow_dispatch path for
    rolling pre-releases. Uses OIDC (id-token: write); no FlakeHub
    secret required.
  • docs/installation.md: new "Nix flake" section documenting one-shot
    nix run, the cachix cache enable command, external flake input
    pattern (both github: and FlakeHub URLs), NixOS module wiring, Home
    Manager module wiring, and local nix build targets.
  • docs/plans/distribution-coverage.yaml: nix_package notes updated
    to describe the new apps, modules, cachix workflow, and flakehub
    workflow.

Non-goal: this PR does not introduce a NixOS VM test for the module —
that belongs in a follow-up under #1235's "Verification" section once
the cachix cache is producing artifacts, so the VM test does not have
to rebuild the full closure on every run.

Verification

$ devtools verify --quick
...
  "total_duration_s": 40.84,
  "exit_code": 0

Manual smoke (post-merge, against the published flake): nix run github:Sinity/polylogue/master -- --version, nix run github:Sinity/polylogue/master#polylogued -- --help, nix run github:Sinity/polylogue/master#polylogue-mcp -- --help. The cachix
cache hit on a fresh nix build will be visible via nix path-info --json once the first cachix workflow run finishes after merge.

🤖 Generated with Claude Code

Closes #1235.

Problem: The flake builds polylogue and exposes a devshell, and a NixOS
module exists, but external consumers cannot `nix run
github:Sinity/polylogue#polylogued` without checking the repo out, there
is no Home Manager module, and built artifacts are not cached for fresh
hosts. The flake is also undiscoverable outside niche Nix circles.

Solution:
- flake.nix: expose apps.{polylogue,polylogued,polylogue-mcp,default}
  so `nix run github:Sinity/polylogue#<app>` works without a checkout.
  Add homeManagerModules.{default,polylogue} alongside the existing
  nixosModules.{default,polylogue}.
- nix/hm-module.nix: Home Manager module wiring a user-mode
  systemd.user.services.polylogued unit with the same TOML settings
  shape as the NixOS module (archive, daemon, daemon-api,
  browser-capture, embedding, logging).
- .github/workflows/cachix.yml: push the polylogue package, api-python
  closure, and devshell closure to the polylogue cachix cache on master
  pushes and tags. Requires CACHIX_AUTH_TOKEN repository secret.
- .github/workflows/flakehub.yml: publish the flake to FlakeHub on tag
  push, with a workflow_dispatch path for rolling pre-releases. Uses
  OIDC (id-token: write); no FlakeHub secret needed.
- docs/installation.md: Nix flake section documents one-shot `nix run`,
  external flake input pattern, NixOS module wiring,
  Home Manager module wiring, and `nix build` targets. Mentions the
  cachix cache and FlakeHub publication.
- docs/plans/distribution-coverage.yaml: nix_package notes updated to
  describe the new apps, modules, cachix workflow, and flakehub workflow.

Verification: `devtools verify --quick` -> exit_code 0 (30.4s).
`nix flake check`, NixOS VM test, and the `nix run
github:Sinity/polylogue#<app>` smoke against a fresh CI runner are
covered by the existing nix.yml workflow plus the new cachix workflow's
first run after merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@Sinity
Sinity merged commit 0474138 into master May 18, 2026
2 of 3 checks passed
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 18 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f4aa161-cacf-4ffd-8019-98a9be81e1d4

📥 Commits

Reviewing files that changed from the base of the PR and between aaed9be and f562055.

📒 Files selected for processing (6)
  • .github/workflows/cachix.yml
  • .github/workflows/flakehub.yml
  • docs/installation.md
  • docs/plans/distribution-coverage.yaml
  • flake.nix
  • nix/hm-module.nix
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dist/nix-flake-module-1235

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity deleted the feature/dist/nix-flake-module-1235 branch May 18, 2026 20:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f562055e6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread nix/hm-module.nix Resolved
Comment thread nix/hm-module.nix Resolved
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 56.F086 / P1: stale at the checked revision: The old programs.polylogued.settings.daemon.watch option and its TOML emission have been removed. nix/hm-module.nix:12 and nix/hm-module.nix:16 now use the shared settings library, whose option/render tree contains no watch-root field, so the reported silently ignored emitted daemon.watch value is no longer produced.
  • 56.F087 / P1: fixed-already at the checked revision: The shared renderer emits the browser settings under daemon.browser_capture with an underscore. nix/lib/settings.nix:266-271 maps the hyphenated Nix option names to browser_capture, allowed_origins, allow_remote and auth_token, removing the reported browser-capture TOML section mismatch.

Only the rows listed above are dispositioned. Held findings remain open.

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.

feat(dist): Nix flake module/service path with cachix and out-of-repo nix run

1 participant