tools/pkgs/d2.nix

53 lines
1.1 KiB
Nix
Raw Normal View History

2022-11-25 00:13:47 +03:00
{ lib
, buildGoModule
2022-12-13 14:18:53 +03:00
, makeWrapper
, symlinkJoin
2022-11-25 00:13:47 +03:00
, fetchFromGitHub
, installShellFiles
2022-12-13 14:18:53 +03:00
, d2plugin-tala
, withTala ? false
2022-11-25 00:13:47 +03:00
}:
2022-12-13 14:18:53 +03:00
let
version = "2022-12-12";
d2 = buildGoModule
{
pname = "d2";
inherit version;
src = fetchFromGitHub {
owner = "terrastruct";
repo = "d2";
rev = "a557d1a6edeb18d692c1e1c20c3c0f0cffc2ed21";
sha256 = "sha256-EzaBURGLnxSX+1FjYQLP7oxov7dGk7xhAnpV8DPzW/g=";
};
vendorSha256 = "sha256-p0os+ap2k5nYWI4+Hf4pwJfHTXaPJldJmf6nznhuRFA=";
ldflags = [
"-s"
"-w"
"-X oss.terrastruct.com/d2/lib/version.Version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
patches = [
../patches/d2/402_preserve_leading_comment_spacing.patch
];
postInstall = "installManPage ci/release/template/man/d2.1";
subPackages = [ "." ];
};
in
symlinkJoin {
name = "d2";
paths = [ d2 ] ++ lib.optional withTala [ d2plugin-tala ];
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/d2 \
--prefix PATH : "$out/bin"
'';
2022-11-25 00:13:47 +03:00
}