From 22ae0b20d009c3228d863d0c495302e64eabf8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=B7=F0=90=91=91=F0=90=91=B4=F0=90=91=95=F0=90=91=91?= =?UTF-8?q?=F0=90=91=A9=F0=90=91=A4?= Date: Mon, 4 Aug 2025 16:55:12 +0700 Subject: [PATCH] ocamlPackages.jsont: flags to turn off optional dependencies --- .../ocaml-modules/jsont/default.nix | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pkgs/development/ocaml-modules/jsont/default.nix b/pkgs/development/ocaml-modules/jsont/default.nix index 816d33329d09..70a88865a76d 100644 --- a/pkgs/development/ocaml-modules/jsont/default.nix +++ b/pkgs/development/ocaml-modules/jsont/default.nix @@ -1,9 +1,13 @@ { lib, fetchzip, + topkg, buildTopkgPackage, + withBrr ? true, brr, + withBytesrw ? true, bytesrw, + withCmdliner ? true, cmdliner, }: @@ -18,17 +22,22 @@ buildTopkgPackage rec { hash = "sha256-dXHl+bLuIrlrQ5Np37+uVuETFBb3j8XeDVEK9izoQFk="; }; - # docs say these dependendencies are optional, but buildTopkgPackage doesn’t - # handle missing dependencies + buildInputs = lib.optional withCmdliner cmdliner; - buildInputs = [ - cmdliner - ]; + propagatedBuildInputs = lib.optional withBrr brr ++ lib.optional withBytesrw bytesrw; - propagatedBuildInputs = [ - brr - bytesrw - ]; + buildPhase = "${topkg.run} build ${ + lib.escapeShellArgs [ + "--with-brr" + (lib.boolToString withBrr) + + "--with-bytesrw" + (lib.boolToString withBytesrw) + + "--with-cmdliner" + (lib.boolToString withCmdliner) + ] + }"; meta = { description = "Declarative JSON data manipulation";