Add d2 diagramming language

This commit is contained in:
Jeremy Wall 2023-12-18 07:01:44 -05:00
parent 61e60e395c
commit 27eb76e00e
3 changed files with 59 additions and 3 deletions

54
nix/base-system/d2.nix Normal file
View File

@ -0,0 +1,54 @@
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, git
, testers
, d2
}:
buildGoModule rec {
pname = "d2";
version = "0.6.3";
src = fetchFromGitHub {
owner = "terrastruct";
repo = pname;
rev = "v${version}";
hash = "sha256-GImv4OJHanj6dKtAJpTaGLrR4AaVTboiYHwRdh/gXaU";
};
vendorHash = "sha256-T7eki06fQuGvYIJKvBJsIkFS1fQ9Jbv+ieUSr2vupqg=";
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 = "A modern diagram scripting language that turns text to diagrams";
homepage = "https://d2lang.com";
license = licenses.mpl20;
};
}

View File

@ -40,6 +40,7 @@
inherit (pkgs.tree-sitter) buildGrammar;
inherit (pkgs) fetchFromGitHub;
};
d2-lang = pkgs.callPackage ./d2.nix {};
# TODO(jwall): When this actually builds we should use it.
#nvim-treesitter-powershell = pkgs.callPackage ./nvim-powershell.nix {
# inherit (pkgs.tree-sitter) buildGrammar;
@ -193,6 +194,7 @@ EOF";
})
lua-language-server
jdk
d2-lang
plantuml-c4
texlive.combined.scheme-basic
nssTools

6
nix/darwin/flake.lock generated
View File

@ -36,12 +36,12 @@
},
"locked": {
"lastModified": 1,
"narHash": "sha256-SL1y1rZnHBuBxRGN51dYZnM9F5HUBLUXLm0MvaKW3eU=",
"path": "/nix/store/45f3c4yrah5v22ka0ax58qrgxjz4h50b-source/nix/base-system",
"narHash": "sha256-oYMNKaAUEjuXaevB25lSy4tTg047aKzr7dotcL573Vw=",
"path": "/nix/store/jhrragm07slg62sy6c9726zwwpxfzrs4-source/nix/base-system",
"type": "path"
},
"original": {
"path": "/nix/store/45f3c4yrah5v22ka0ax58qrgxjz4h50b-source/nix/base-system",
"path": "/nix/store/jhrragm07slg62sy6c9726zwwpxfzrs4-source/nix/base-system",
"type": "path"
}
},