Stitch any CI into Tangled
1{
2 description = "tack";
3
4 inputs = {
5 nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
6 flake-utils.url = "github:numtide/flake-utils";
7 };
8
9 outputs = {
10 nixpkgs,
11 flake-utils,
12 ...
13 }:
14 flake-utils.lib.eachDefaultSystem (
15 system: let
16 pkgs = nixpkgs.legacyPackages.${system};
17
18 # The tack binary itself. We use buildGoModule because the module is
19 # a single `main` package at the repo root with internal subpackages.
20 # CGO is required for github.com/mattn/go-sqlite3.
21 tack = pkgs.buildGoModule {
22 pname = "tack";
23 version = "0.1.0";
24 src = ./.;
25
26 # vendorHash pins the Go module download FOD. Update this whenever
27 # go.mod / go.sum changes by replacing it with lib.fakeHash and
28 # rebuilding to surface the new hash.
29 vendorHash = "sha256-2G9Bhflpw0BDcytKB4oOGIi3HR2fFd1rwZFcoIC09TQ=";
30
31 # The repo ships a stale `tack` binary at the root that gets caught
32 # by `go test ./...`-style discovery; ignore it during the build.
33 subPackages = ["."];
34
35 # mattn/go-sqlite3 needs cgo + a C compiler.
36 env.CGO_ENABLED = "1";
37 };
38 in {
39 devShells.default = pkgs.mkShell {
40 packages = [
41 pkgs.go
42 ];
43 };
44
45 packages = {
46 default = tack;
47 tack = tack;
48 };
49
50 apps = {
51 default = {
52 type = "app";
53 program = "${tack}/bin/tack";
54 };
55 tack = {
56 type = "app";
57 program = "${tack}/bin/tack";
58 };
59 };
60 }
61 );
62}