depot/third_party/nixpkgs/pkgs/tools/text/d2/default.nix
Default email c7e6337bd0 Project import generated by Copybara.
GitOrigin-RevId: 08e4dc3a907a6dfec8bb3bbf1540d8abbffea22b
2023-04-29 12:46:19 -04:00

52 lines
1.1 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, git
, testers
, d2
}:
buildGoModule rec {
pname = "d2";
version = "0.4.1";
src = fetchFromGitHub {
owner = "terrastruct";
repo = pname;
rev = "v${version}";
hash = "sha256-4VoWAft9d0v/kB+B8Ukv/XN613a8N484SMqCbOD2GFI=";
};
vendorHash = "sha256-oPI6FPfBIPKZDLoyGblcG5UcmoFWufZ2NIEClpSIJzU=";
excludedPackages = [ "./e2etests" ];
ldflags = [
"-s"
"-w"
"-X oss.terrastruct.com/d2/lib/version.Version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installManPage ci/release/template/man/d2.1
'';
nativeCheckInputs = [ git ];
preCheck = ''
# See https://github.com/terrastruct/d2/blob/master/docs/CONTRIBUTING.md#running-tests.
export TESTDATA_ACCEPT=1
'';
passthru.tests.version = testers.testVersion { package = d2; };
meta = with lib; {
description = "A modern diagram scripting language that turns text to diagrams";
homepage = "https://d2lang.com";
license = licenses.mpl20;
maintainers = with maintainers; [ dit7ya ];
};
}