d2: add self-referencing connections patch
This commit is contained in:
parent
e3555cf2cb
commit
911e92f3e1
4 changed files with 32 additions and 38 deletions
|
@ -13,7 +13,7 @@
|
||||||
final: prev:
|
final: prev:
|
||||||
final.setAttrByPath [ name ] (mkPackage name prev);
|
final.setAttrByPath [ name ] (mkPackage name prev);
|
||||||
|
|
||||||
allPackageNames = [ "d2" "d2_unstable" ];
|
allPackageNames = [ "d2" ];
|
||||||
mkAllPackages = pkgs':
|
mkAllPackages = pkgs':
|
||||||
listToAttrs
|
listToAttrs
|
||||||
(map
|
(map
|
||||||
|
|
25
patches/d2/self_referencing_connections.patch
Normal file
25
patches/d2/self_referencing_connections.patch
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go
|
||||||
|
index 7bc2ba1..750eb17 100644
|
||||||
|
--- a/d2graph/d2graph.go
|
||||||
|
+++ b/d2graph/d2graph.go
|
||||||
|
@@ -710,20 +710,16 @@ func (obj *Object) Connect(srcID, dstID []string, srcArrow, dstArrow bool, label
|
||||||
|
return nil, errors.New("cannot connect to reserved keyword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
src := srcObj.EnsureChild(srcID)
|
||||||
|
dst := dstObj.EnsureChild(dstID)
|
||||||
|
|
||||||
|
- if src == dst {
|
||||||
|
- return nil, errors.New("self-referencing connection")
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
edge := &Edge{
|
||||||
|
Attributes: Attributes{
|
||||||
|
Label: Scalar{
|
||||||
|
Value: label,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Src: src,
|
||||||
|
SrcArrow: srcArrow,
|
10
pkgs/d2.nix
10
pkgs/d2.nix
|
@ -4,7 +4,7 @@
|
||||||
, installShellFiles
|
, installShellFiles
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let version = "0.0.13"; in
|
let version = "2022-11-30"; in
|
||||||
|
|
||||||
buildGoModule {
|
buildGoModule {
|
||||||
pname = "d2";
|
pname = "d2";
|
||||||
|
@ -13,11 +13,11 @@ buildGoModule {
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "terrastruct";
|
owner = "terrastruct";
|
||||||
repo = "d2";
|
repo = "d2";
|
||||||
rev = "v${version}";
|
rev = "e6c7d066164040098d294c00779a2248c402c864";
|
||||||
sha256 = "sha256-2abGQmgwqxWFk7NScdgfEjRYZF2rw8kxTKRwcl2LRg0=";
|
sha256 = "sha256-Qlm5i7l4/ZdVulXVOyry3cwZp7bIDbCXUZ5PngpD9bM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
vendorSha256 = "sha256-/BEl4UqOL4Ux7I2eubNH2YGGl4DxntpI5WN9ggvYu80=";
|
vendorSha256 = "sha256-yNaocc1iaOHlLqDLql+3XWL9j0RoxBXSWATi7QCNgJI=";
|
||||||
|
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-s"
|
"-s"
|
||||||
|
@ -27,6 +27,8 @@ buildGoModule {
|
||||||
|
|
||||||
nativeBuildInputs = [ installShellFiles ];
|
nativeBuildInputs = [ installShellFiles ];
|
||||||
|
|
||||||
|
patches = [ ../patches/d2/self_referencing_connections.patch ];
|
||||||
|
|
||||||
postInstall = "installManPage ci/release/template/man/d2.1";
|
postInstall = "installManPage ci/release/template/man/d2.1";
|
||||||
|
|
||||||
subPackages = [ "cmd/d2" ];
|
subPackages = [ "cmd/d2" ];
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
{ lib
|
|
||||||
, buildGoModule
|
|
||||||
, fetchFromGitHub
|
|
||||||
, installShellFiles
|
|
||||||
}:
|
|
||||||
|
|
||||||
let version = "2022-11-30"; in
|
|
||||||
|
|
||||||
buildGoModule {
|
|
||||||
pname = "d2";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "terrastruct";
|
|
||||||
repo = "d2";
|
|
||||||
rev = "e6c7d066164040098d294c00779a2248c402c864";
|
|
||||||
sha256 = "sha256-Qlm5i7l4/ZdVulXVOyry3cwZp7bIDbCXUZ5PngpD9bM=";
|
|
||||||
};
|
|
||||||
|
|
||||||
vendorSha256 = "sha256-yNaocc1iaOHlLqDLql+3XWL9j0RoxBXSWATi7QCNgJI=";
|
|
||||||
|
|
||||||
ldflags = [
|
|
||||||
"-s"
|
|
||||||
"-w"
|
|
||||||
"-X oss.terrastruct.com/d2/lib/version.Version=${version}"
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ installShellFiles ];
|
|
||||||
|
|
||||||
postInstall = "installManPage ci/release/template/man/d2.1";
|
|
||||||
|
|
||||||
subPackages = [ "cmd/d2" ];
|
|
||||||
}
|
|
Loading…
Reference in a new issue