mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-21 08:01:31 +00:00
d2: add withImageSupport guard to allow closure size reduction (#538666)
This commit is contained in:
@@ -11,8 +11,13 @@
|
||||
libgbm,
|
||||
makeWrapper,
|
||||
playwright-driver,
|
||||
withImageSupport ? lib.meta.availableOn stdenv.hostPlatform libdrm,
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (
|
||||
withImageSupport -> lib.meta.availableOn stdenv.hostPlatform libdrm
|
||||
) "d2: withImageSupport is not supported on ${stdenv.hostPlatform.system} (requires libdrm)";
|
||||
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "d2";
|
||||
version = "0.7.1";
|
||||
@@ -39,7 +44,8 @@ buildGoModule (finalAttrs: {
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals (lib.meta.availableOn stdenv.hostPlatform libdrm) [
|
||||
# playwright-drivers.browsers pulls down ~2GB+ for Webkit, Chrome, Firefox etc
|
||||
buildInputs = lib.optionals withImageSupport [
|
||||
libgbm
|
||||
playwright-driver.browsers
|
||||
];
|
||||
@@ -50,7 +56,7 @@ buildGoModule (finalAttrs: {
|
||||
installManPage ci/release/template/man/d2.1
|
||||
''
|
||||
# Wrap the d2 executable to set LD_LIBRARY_PATH for Playwright
|
||||
+ lib.optionalString (finalAttrs.buildInputs != [ ]) ''
|
||||
+ lib.optionalString withImageSupport ''
|
||||
wrapProgram $out/bin/d2 \
|
||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath finalAttrs.buildInputs}
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user