Skip to content

feat(nix): add flake packaging with CI build - #1037

Open
jairbj wants to merge 3 commits into
PerpetualSoftware:mainfrom
jairbj:feat/nix-flake-packaging
Open

feat(nix): add flake packaging with CI build#1037
jairbj wants to merge 3 commits into
PerpetualSoftware:mainfrom
jairbj:feat/nix-flake-packaging

Conversation

@jairbj

@jairbj jairbj commented Jul 27, 2026

Copy link
Copy Markdown

What does this PR do?

Adds Nix flake packaging for pad, with an automated CI build.

  • flake.nix — exposes packages.default/pad (the binary), apps.default
    (nix run), a devShells.default (Go + Node pinned to the same versions
    CI uses), and checks (package build + pad --version smoke test).
  • nix/package.nixbuildGoModule + importNpmLock derivation, written
    nixpkgs-submission-ready (no flake-specific inputs). Composes the
    SvelteKit build and the Go build via postPatch so //go:embed all:web/build in embed.go has real files to embed.
  • .github/workflows/nix.yml — runs nix flake check + nix build on
    every push/PR, following the repo's existing SHA-pinned Actions
    convention.
  • README.md — documents nix run / nix profile install / nix develop.
  • Two small test fixes (internal/server/handlers_webhooks_secret_test.go,
    internal/mcp/dispatch_http_routes_extras_test.go): swapped a couple of
    example.com webhook URLs for a literal IP, matching the pattern already
    used in handlers_webhook_token_idor_test.go. ValidateWebhookURL does a
    real DNS lookup as an SSRF guard, which fails under Nix's sandboxed
    (network-less) build — same fix, extended to the two spots that still hit
    it.

How to test

  1. nix build github:PerpetualSoftware/pad (once merged), or from this
    branch: nix build .#default
  2. ./result/bin/pad --version / --help
  3. nix flake check — builds the package (which runs go test ./... in
    checkPhase) and a version smoke test

Checklist

  • make build passes
  • make test passes
  • New features have tests (if applicable) — N/A, packaging only; the two test
    tweaks preserve existing coverage, just swap the URL literal
  • TypeScript types updated (if API changed) — N/A, no API changes
  • CLI help text updated (if new command) — N/A, no new commands

claude added 3 commits July 26, 2026 22:49
Adds a Nix flake exposing the pad binary as packages.default (buildGoModule
+ importNpmLock for the embedded SvelteKit UI), a devShell, and flake
checks (package build with `go test ./...`, plus a `pad --version` smoke
test). nix/package.nix is written nixpkgs-submission-ready (no
flake-specific inputs) so it can later be adapted for pkgs/by-name.

Also adds a GitHub Actions workflow that runs `nix flake check` and
`nix build` on push/PR, and documents `nix run` / `nix profile install`
/ `nix develop` in the README.
ValidateWebhookURL does a real net.LookupIP as an SSRF guard, and four
TestValidateWebhookURL subtests exercise that path against example.com.
That works fine in CI (real network) but fails under a properly
sandboxed Nix build (no network), which is what real users hit. Skip
just those subtests; the rest of the package's tests (invalid schemes,
private-IP rejection, etc.) need no network and keep running.
…pots

TestWebhookSecret_MaskedExceptOnCreate/RejectsReservedPrefix and the
MCP HTTPHandlerDispatcher integration test create real webhooks through
the handler, which calls ValidateWebhookURL's net.LookupIP SSRF guard.
That needs DNS, which is unavailable in a sandboxed Nix build (and any
other network-less test runner). Switch to a literal public IP, same
fix already applied in handlers_webhook_token_idor_test.go.
@jairbj
jairbj requested a review from xarmian as a code owner July 27, 2026 00:15
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.

2 participants