-
-
Notifications
You must be signed in to change notification settings - Fork 38
Add Nix flake for devenv.sh / NixOS integration #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,5 +48,20 @@ brews: | |
| name: homebrew-tap | ||
| token: "{{ .Env.TAP_GITHUB_TOKEN }}" | ||
|
|
||
| nix: | ||
| # Publishes a Nix derivation that installs pre-built binaries to | ||
| # the mickamy/nur-packages repository on each release. | ||
| # Prerequisites: | ||
| # 1. Create the mickamy/nur-packages repository (NUR-compatible layout). | ||
| # 2. Add "install nix" step to the release workflow so nix-hash is available. | ||
| - name: sql-tap | ||
| homepage: https://github.com/mickamy/sql-tap | ||
| description: Watch SQL traffic in real-time with a TUI | ||
| license: mit | ||
| repository: | ||
| owner: mickamy | ||
| name: nur-packages | ||
| token: "{{ .Env.TAP_GITHUB_TOKEN }}" | ||
|
|
||
|
Comment on lines
+51
to
+65
|
||
| changelog: | ||
| sort: asc | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,35 @@ cd sql-tap | |||||||
| make install | ||||||||
| ``` | ||||||||
|
|
||||||||
| ### Nix | ||||||||
|
|
||||||||
| **Using the flake directly** | ||||||||
|
|
||||||||
| ```bash | ||||||||
| nix profile install github:mickamy/sql-tap | ||||||||
|
||||||||
| nix profile install github:mickamy/sql-tap | |
| # Install both the TUI client (sql-tap) and the proxy daemon (sql-tapd) | |
| nix profile install github:mickamy/sql-tap#sql-tap github:mickamy/sql-tap#sql-tapd |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||||||
| { | ||||||||||
| description = "Real-time SQL traffic viewer — proxy daemon + TUI / Web client"; | ||||||||||
|
|
||||||||||
| inputs = { | ||||||||||
| nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||||||||||
| flake-utils.url = "github:numtide/flake-utils"; | ||||||||||
|
||||||||||
| }; | ||||||||||
|
|
||||||||||
| outputs = | ||||||||||
| { self | ||||||||||
| , nixpkgs | ||||||||||
| , flake-utils | ||||||||||
| }: | ||||||||||
| flake-utils.lib.eachDefaultSystem (system: | ||||||||||
| let | ||||||||||
| pkgs = nixpkgs.legacyPackages.${system}; | ||||||||||
| version = self.shortRev or self.dirtyShortRev or "dev"; | ||||||||||
| in | ||||||||||
| { | ||||||||||
| packages = { | ||||||||||
| sql-tap = pkgs.buildGoModule { | ||||||||||
| pname = "sql-tap"; | ||||||||||
| inherit version; | ||||||||||
| src = pkgs.lib.cleanSource self; | ||||||||||
| subPackages = [ "." "cmd/sql-tapd" ]; | ||||||||||
|
|
||||||||||
| # When go.mod or go.sum changes, update this hash by running: | ||||||||||
| # nix build 2>&1 | grep "got:" | awk '{print $2}' | ||||||||||
| # and replacing pkgs.lib.fakeHash below with the output. | ||||||||||
| vendorHash = pkgs.lib.fakeHash; | ||||||||||
|
Comment on lines
+29
to
+30
|
||||||||||
| # and replacing pkgs.lib.fakeHash below with the output. | |
| vendorHash = pkgs.lib.fakeHash; | |
| # and replacing this null value below with the output. | |
| vendorHash = null; |
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subPackages = [ "." "cmd/sql-tapd" ] builds both the sql-tap (TUI client) and sql-tapd (proxy daemon) binaries in a single derivation. However, the ldflags only inject the version into main.version for one package at a time — the -X main.version=… flag only applies to the main package being built. Since there are two separate main packages (one at the root and one at cmd/sql-tapd), only one of them will receive the correct version injection. The sql-tapd binary at cmd/sql-tapd/main.go also declares var version = "dev" and this ldflag will only update one of the two main packages. You should split these into two separate buildGoModule derivations with their own ldflags, or verify that buildGoModule correctly propagates -X main.version to all subPackages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
nix:publisher section in.goreleaser.yamlis missing theinstallstanza. Looking at thebrews:block above (lines 43-45), the Homebrew tap explicitly installs bothsql-tapandsql-tapdbinaries. Without aninstallfield, the goreleaser Nix publisher will default to only installing the binary that matches the packagename(sql-tap), meaning thesql-tapddaemon binary will not be installed via the NUR package. Consider adding an explicitinstallfield to ensuresql-tapdis also installed alongsidesql-tap.