{ pkgs ? import {}, doc2go ? pkgs.doc2go, lib ? pkgs.lib, go ? pkgs.go, pandoc ? pkgs.pandoc, stdenv ? pkgs.stdenv, }: let index_template = pkgs.writeText "doc_template.html" '' $body$ ''; docPages = { "assert" = { title = "package assert"; desc = "Docs page for antithesis sdk golang assert package"; }; random = { title = "package random"; desc = "Docs page for antithesis sdk golang random package"; }; lifecycle = { title = "package lifecycle"; desc = "Docs page for antithesis sdk golang lifecycle package"; }; }; docs = stdenv.mkDerivation { name = "go_sdk_docs"; src = ./.; # TODO: filter nativeBuildInputs = [ go pandoc (doc2go.overrideAttrs (old: { patches = (old.patches or [ ]) ++ [ ./doc2go-headers.patch ./doc2go-title.patch ./doc2go-meta-desc.patch ]; doCheck = false; })) ]; buildPhase = '' export HOME=$TMPDIR mkdir -p $out/docs # TODO: can add `-emded` to generate basic stubs for the docs with no styling to customize our own doc2go -home github.com/antithesishq/antithesis-sdk-go -out $out/docs ${lib.concatMapStringsSep " " (p: "./${p}") (lib.attrNames docPages)} ${lib.concatMapStringsSep "\n" ({ name, value }: let title = value.title or "package ${name}"; in '' substituteInPlace $out/docs/${name}/index.html --replace-fail "%META_DESCRIPTION%" "${value.desc}" substituteInPlace $out/docs/${name}/index.html --replace-fail "%TITLE%" "${title}" '') (lib.attrsToList docPages)} pandoc --template ${index_template} -o $out/index.html README.md ''; }; go_sdk = pkgs.buildGoModule { pname = "antithesis-go-sdk"; version = "v0.3.4"; src = ./.; vendorHash = "sha256-K/4hq42VooKVwHydh+SWB8YAzumkONpglfHyRvr82z8="; meta = { description = "Antithesis go sdk."; homepage = "https://github.com/antithesishq/antithesis-sdk-go"; platforms = lib.platforms.linux; licenses = lib.licenses.mit; }; }; go_sdk_no_antithesis = go_sdk.overrideAttrs (old: { pname = "antithesis-go-sdk-no-antithesis"; checkFlags = (old.checkFlags or []) ++ ["-tags=no_antithesis_sdk"]; }); # Builds and tests the SDK with cgo disabled (a frequently encountered misconfiguration) go_sdk_no_cgo = go_sdk.overrideAttrs (old: { pname = "antithesis-go-sdk-no-cgo"; env = old.env // { CGO_ENABLED = "0"; }; }); in { inherit docs go_sdk go_sdk_no_antithesis go_sdk_no_cgo; }