depot/third_party/nixpkgs/pkgs/tools/text/d2/default.nix
Default email 472aeafc57 Project import generated by Copybara.
GitOrigin-RevId: c31898adf5a8ed202ce5bea9f347b1c6871f32d1
2024-10-04 18:56:33 +02:00

57 lines
1.2 KiB
Nix

{ lib
, buildGo123Module
, fetchFromGitHub
, installShellFiles
, git
, testers
, d2
}:
buildGo123Module rec {
pname = "d2";
version = "0.6.7";
src = fetchFromGitHub {
owner = "terrastruct";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-HD59q4GFrkjLvQQdYGA7ISwXJztweRxoV5AWbHinTx8=";
};
vendorHash = "sha256-HcWyhQFRI+dvOhUrVaL9U5PvL/CDBpaOYPXSkYzIYf4=";
excludedPackages = [ "./e2etests" ];
ldflags = [
"-s"
"-w"
"-X oss.terrastruct.com/d2/lib/version.Version=v${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;
version = "v${version}";
};
meta = with lib; {
description = "Modern diagram scripting language that turns text to diagrams";
mainProgram = "d2";
homepage = "https://d2lang.com";
changelog = "https://github.com/terrastruct/d2/releases/tag/v${version}";
license = licenses.mpl20;
maintainers = with maintainers; [ dit7ya kashw2 ];
};
}