From 50bce7ec3b690bb4c06f610e89231a48bd493a62 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 1 May 2026 15:51:40 -0700 Subject: [PATCH] flake package + program --- README.md | 4 ---- flake.nix | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 972ee8f..a03c78d 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,6 @@ status, counts, etc. can show up inline in things like pull requests. sh.tangled.pipeline.status ``` -```sh -go run . -addr :8080 -``` - ## Configuration Core configuration controls how tack talks to Tangled. Provider-specific diff --git a/flake.nix b/flake.nix index f5eddb9..d98e5e7 100644 --- a/flake.nix +++ b/flake.nix @@ -14,12 +14,49 @@ flake-utils.lib.eachDefaultSystem ( system: let pkgs = nixpkgs.legacyPackages.${system}; + + # The tack binary itself. We use buildGoModule because the module is + # a single `main` package at the repo root with internal subpackages. + # CGO is required for github.com/mattn/go-sqlite3. + tack = pkgs.buildGoModule { + pname = "tack"; + version = "0.1.0"; + src = ./.; + + # vendorHash pins the Go module download FOD. Update this whenever + # go.mod / go.sum changes by replacing it with lib.fakeHash and + # rebuilding to surface the new hash. + vendorHash = "sha256-2G9Bhflpw0BDcytKB4oOGIi3HR2fFd1rwZFcoIC09TQ="; + + # The repo ships a stale `tack` binary at the root that gets caught + # by `go test ./...`-style discovery; ignore it during the build. + subPackages = ["."]; + + # mattn/go-sqlite3 needs cgo + a C compiler. + env.CGO_ENABLED = "1"; + }; in { devShells.default = pkgs.mkShell { packages = [ pkgs.go ]; }; + + packages = { + default = tack; + tack = tack; + }; + + apps = { + default = { + type = "app"; + program = "${tack}/bin/tack"; + }; + tack = { + type = "app"; + program = "${tack}/bin/tack"; + }; + }; } ); } -- 2.51.2