From 81f38986a2a63ed9b1a61e60c700a9f01bd96f3f Mon Sep 17 00:00:00 2001 From: krabodyan <149960577+krabodyan@users.noreply.github.com> Date: Wed, 2 Apr 2025 17:26:34 +0300 Subject: [PATCH] jq: add missing color option (#6734) added "color for object keys" option https://jqlang.org/manual/#colors --- modules/misc/news.nix | 11 +++++++++++ modules/programs/jq.nix | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/modules/misc/news.nix b/modules/misc/news.nix index e3c10d1f..bf524974 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2211,6 +2211,17 @@ in { Nix's store) old Home-Manager generations. ''; } + + { + time = "2025-03-31T16:39:41+00:00"; + condition = config.programs.jq.enable; + message = '' + Jq module now supports color for object keys + + Your configuration will break if you have defined the "programs.jq.colors" option. + To resolve this, please add `objectKeys` to your assignment of `programs.jq.colors`. + ''; + } ]; }; } diff --git a/modules/programs/jq.nix b/modules/programs/jq.nix index 3bd522d6..032201d6 100644 --- a/modules/programs/jq.nix +++ b/modules/programs/jq.nix @@ -20,6 +20,7 @@ let strings = colorType; arrays = colorType; objects = colorType; + objectKeys = colorType; }; }; @@ -45,13 +46,14 @@ in { example = lib.literalExpression '' { - null = "1;30"; - false = "0;31"; - true = "0;32"; - numbers = "0;36"; - strings = "0;33"; - arrays = "1;35"; - objects = "1;37"; + null = "1;30"; + false = "0;31"; + true = "0;32"; + numbers = "0;36"; + strings = "0;33"; + arrays = "1;35"; + objects = "1;37"; + objectKeys = "1;34"; } ''; @@ -63,6 +65,7 @@ in { strings = "0;32"; arrays = "1;37"; objects = "1;37"; + objectKeys = "1;34"; }; type = colorsType; @@ -76,7 +79,7 @@ in { home.sessionVariables = let c = cfg.colors; in { JQ_COLORS = - "${c.null}:${c.false}:${c.true}:${c.numbers}:${c.strings}:${c.arrays}:${c.objects}"; + "${c.null}:${c.false}:${c.true}:${c.numbers}:${c.strings}:${c.arrays}:${c.objects}:${c.objectKeys}"; }; }; }