From 428deb18ab93507bf685ab4a07788afc83103c94 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Wed, 22 Oct 2025 13:38:17 +0200 Subject: [PATCH 1/4] bat-extras: minor improvements --- pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix | 12 +++++++----- .../bat-extras/patches/disable-theme-tests.patch | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix b/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix index 7c7d36d397d0..34a526ff9e26 100644 --- a/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix +++ b/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix @@ -12,6 +12,7 @@ }: let cleanArgs = lib.flip removeAttrs [ + "name" "dependencies" "meta" ]; @@ -26,6 +27,7 @@ stdenv.mkDerivation ( finalAttrs: cleanArgs args // { + pname = name; inherit (core) version; src = core; @@ -35,14 +37,14 @@ stdenv.mkDerivation ( buildInputs = dependencies; # Patch shebangs now because our tests rely on them - postPatch = '' + postPatch = (args.postPatch or "") + '' patchShebangs --host bin/${name} ''; dontConfigure = true; - dontBuild = true; # we've already built + dontBuild = true; # we've already built it - doCheck = true; + doCheck = args.doCheck or true; nativeCheckInputs = [ bat bash @@ -52,7 +54,7 @@ stdenv.mkDerivation ( ++ (lib.optionals stdenv.hostPlatform.isDarwin [ getconf ]); checkPhase = '' runHook preCheck - bash ./test.sh --compiled --suite ${name} + bash ./test.sh --compiled --suite ${name} --verbose --snapshot:show runHook postCheck ''; @@ -69,7 +71,7 @@ stdenv.mkDerivation ( runHook postInstall ''; - # We already patched + # We have already patched dontPatchShebangs = true; meta = core.meta // { mainProgram = name; } // meta; diff --git a/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch b/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch index 695d350a2a30..31aad00c3028 100644 --- a/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch +++ b/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch @@ -7,7 +7,7 @@ diff --git a/test/suite/batpipe.sh b/test/suite/batpipe.sh test:batpipe_term_width() { description "Test support for BATPIPE_TERM_WIDTH" snapshot STDOUT -+ skip "bat-extras does not support `--theme` flag" ++ skip "bat-extras does not support '--theme' flag" export BATPIPE=color export BATPIPE_DEBUG_PARENT_EXECUTABLE=less @@ -20,7 +20,7 @@ diff --git a/test/suite/batgrep.sh b/test/suite/batgrep.sh description "Snapshot test for colored output." snapshot stdout snapshot stderr -+ skip "bat-extras does not support `--theme` flag" ++ skip "bat-extras does not support '--theme' flag" require_rg @@ -28,7 +28,7 @@ diff --git a/test/suite/batgrep.sh b/test/suite/batgrep.sh description "Should respect the BAT_STYLE variable." snapshot stdout snapshot stderr -+ skip "bat-extras does not support `--theme` flag" ++ skip "bat-extras does not support '--theme' flag" require_rg @@ -36,7 +36,7 @@ diff --git a/test/suite/batgrep.sh b/test/suite/batgrep.sh description "Snapshot test for output without separator" snapshot stdout snapshot stderr -+ skip "bat-extras does not support `--theme` flag" ++ skip "bat-extras does not support '--theme' flag" require_rg From a996e5339e424e82b3d8be745d26a442a8b46934 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Wed, 22 Oct 2025 13:39:52 +0200 Subject: [PATCH 2/4] bat-extras: 2024.08.24 -> 2024.08.24-unstable-2025-02-22 --- .../tools/misc/bat-extras/modules/batpipe.nix | 9 +++- pkgs/tools/misc/bat-extras/modules/core.nix | 12 +++--- .../patches/batpipe-skip-outdated-test.patch | 12 ++++++ .../patches/disable-theme-tests.patch | 42 ------------------- 4 files changed, 25 insertions(+), 50 deletions(-) create mode 100644 pkgs/tools/misc/bat-extras/patches/batpipe-skip-outdated-test.patch delete mode 100644 pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch diff --git a/pkgs/tools/misc/bat-extras/modules/batpipe.nix b/pkgs/tools/misc/bat-extras/modules/batpipe.nix index 2740444bb26d..1f1a0352094f 100644 --- a/pkgs/tools/misc/bat-extras/modules/batpipe.nix +++ b/pkgs/tools/misc/bat-extras/modules/batpipe.nix @@ -1,9 +1,16 @@ { buildBatExtrasPkg, less, + procps, }: buildBatExtrasPkg { name = "batpipe"; - dependencies = [ less ]; + dependencies = [ + less + procps + ]; + patches = [ + ../patches/batpipe-skip-outdated-test.patch + ]; meta.description = "Less (and soon bat) preprocessor for viewing more types of files in the terminal"; } diff --git a/pkgs/tools/misc/bat-extras/modules/core.nix b/pkgs/tools/misc/bat-extras/modules/core.nix index b27f8be6e3e1..b7469055f903 100644 --- a/pkgs/tools/misc/bat-extras/modules/core.nix +++ b/pkgs/tools/misc/bat-extras/modules/core.nix @@ -9,15 +9,15 @@ nix-update-script, zsh, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation { pname = "bat-extras"; - version = "2024.08.24"; + version = "2024.08.24-unstable-2025-02-22"; src = fetchFromGitHub { owner = "eth-p"; repo = "bat-extras"; - tag = "v${version}"; - hash = "sha256-xkND/w6UNC58dC8WrsifwjqU9ZI4yUUq+ZljkhhUNT8="; + rev = "3860f0f1481f1d0e117392030f55ef19cc018ee4"; + hash = "sha256-9TEq/LzE1Pty1Z3WFWR/TaNNKPp2LGBr0jzGBkOEGQo="; fetchSubmodules = true; }; @@ -26,8 +26,6 @@ stdenv.mkDerivation rec { dontConfigure = true; - patches = [ ../patches/disable-theme-tests.patch ]; - postPatch = '' patchShebangs --build test.sh test/shimexec .test-framework/bin/best.sh ''; @@ -72,7 +70,7 @@ stdenv.mkDerivation rec { # The per-script derivations will go ahead and patch the files they actually install. dontPatchShebangs = true; - passthru.updateScript = nix-update-script { }; + passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; }; meta = { description = "Bash scripts that integrate bat with various command line tools"; diff --git a/pkgs/tools/misc/bat-extras/patches/batpipe-skip-outdated-test.patch b/pkgs/tools/misc/bat-extras/patches/batpipe-skip-outdated-test.patch new file mode 100644 index 000000000000..6ca368863d6c --- /dev/null +++ b/pkgs/tools/misc/bat-extras/patches/batpipe-skip-outdated-test.patch @@ -0,0 +1,12 @@ +diff --git a/test/suite/batpipe.sh b/test/suite/batpipe.sh +index e834f6e..2d9354d 100644 +--- a/test/suite/batpipe.sh ++++ b/test/suite/batpipe.sh +@@ -51,6 +51,7 @@ test:viewer_gzip() { + + test:batpipe_term_width() { + description "Test support for BATPIPE_TERM_WIDTH" ++ skip "Fails on a newer version of bat" + snapshot STDOUT + + export BATPIPE=color diff --git a/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch b/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch deleted file mode 100644 index 31aad00c3028..000000000000 --- a/pkgs/tools/misc/bat-extras/patches/disable-theme-tests.patch +++ /dev/null @@ -1,42 +0,0 @@ -Subject: [PATCH] skip tests depending on color theme -=================================================================== -diff --git a/test/suite/batpipe.sh b/test/suite/batpipe.sh ---- a/test/suite/batpipe.sh (revision 36c77c171cc71b2ff3ec4cb781aa16ca3ad258b1) -+++ b/test/suite/batpipe.sh (date 1736621098865) -@@ -29,6 +29,7 @@ - test:batpipe_term_width() { - description "Test support for BATPIPE_TERM_WIDTH" - snapshot STDOUT -+ skip "bat-extras does not support '--theme' flag" - - export BATPIPE=color - export BATPIPE_DEBUG_PARENT_EXECUTABLE=less -Index: test/suite/batgrep.sh -=================================================================== -diff --git a/test/suite/batgrep.sh b/test/suite/batgrep.sh ---- a/test/suite/batgrep.sh (revision 36c77c171cc71b2ff3ec4cb781aa16ca3ad258b1) -+++ b/test/suite/batgrep.sh (date 1736621086239) -@@ -58,6 +58,7 @@ - description "Snapshot test for colored output." - snapshot stdout - snapshot stderr -+ skip "bat-extras does not support '--theme' flag" - - require_rg - -@@ -118,6 +119,7 @@ - description "Should respect the BAT_STYLE variable." - snapshot stdout - snapshot stderr -+ skip "bat-extras does not support '--theme' flag" - - require_rg - -@@ -128,6 +130,7 @@ - description "Snapshot test for output without separator" - snapshot stdout - snapshot stderr -+ skip "bat-extras does not support '--theme' flag" - - require_rg - From 78f92255c2cf46f5bb1cac0c3823530096310759 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Wed, 22 Oct 2025 14:19:09 +0200 Subject: [PATCH 3/4] bat-extras: also test nushell --- .../misc/bat-extras/buildBatExtrasPkg.nix | 2 ++ .../tools/misc/bat-extras/modules/batpipe.nix | 7 +++++++ pkgs/tools/misc/bat-extras/modules/core.nix | 2 ++ .../batpipe-skip-detection-tests.patch | 20 +++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 pkgs/tools/misc/bat-extras/patches/batpipe-skip-detection-tests.patch diff --git a/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix b/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix index 34a526ff9e26..e4aaeedbd12b 100644 --- a/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix +++ b/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.nix @@ -8,6 +8,7 @@ fish, getconf, makeWrapper, + nushell, zsh, }: let @@ -49,6 +50,7 @@ stdenv.mkDerivation ( bat bash fish + nushell zsh ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ getconf ]); diff --git a/pkgs/tools/misc/bat-extras/modules/batpipe.nix b/pkgs/tools/misc/bat-extras/modules/batpipe.nix index 1f1a0352094f..c8c9a754923d 100644 --- a/pkgs/tools/misc/bat-extras/modules/batpipe.nix +++ b/pkgs/tools/misc/bat-extras/modules/batpipe.nix @@ -1,4 +1,6 @@ { + lib, + stdenv, buildBatExtrasPkg, less, procps, @@ -9,8 +11,13 @@ buildBatExtrasPkg { less procps ]; + patches = [ ../patches/batpipe-skip-outdated-test.patch + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + ../patches/batpipe-skip-detection-tests.patch ]; + meta.description = "Less (and soon bat) preprocessor for viewing more types of files in the terminal"; } diff --git a/pkgs/tools/misc/bat-extras/modules/core.nix b/pkgs/tools/misc/bat-extras/modules/core.nix index b7469055f903..f145b666d21d 100644 --- a/pkgs/tools/misc/bat-extras/modules/core.nix +++ b/pkgs/tools/misc/bat-extras/modules/core.nix @@ -7,6 +7,7 @@ fish, getconf, nix-update-script, + nushell, zsh, }: stdenv.mkDerivation { @@ -41,6 +42,7 @@ stdenv.mkDerivation { nativeCheckInputs = [ bash fish + nushell zsh ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ getconf ]); diff --git a/pkgs/tools/misc/bat-extras/patches/batpipe-skip-detection-tests.patch b/pkgs/tools/misc/bat-extras/patches/batpipe-skip-detection-tests.patch new file mode 100644 index 000000000000..b051545647a8 --- /dev/null +++ b/pkgs/tools/misc/bat-extras/patches/batpipe-skip-detection-tests.patch @@ -0,0 +1,20 @@ +diff --git a/test/suite/batpipe.sh b/test/suite/batpipe.sh +index e834f6e..da87411 100644 +--- a/test/suite/batpipe.sh ++++ b/test/suite/batpipe.sh +@@ -12,6 +12,7 @@ test:detected_bash_shell() { + + test:detected_fish_shell() { + description "Test it can detect a fish shell." ++ skip "This test fails in the Nix sandbox" + + # Note: We don't use bash's `-c` option when testing with a fake fish shell. + # Bash `-c` will automatically exec() into the last process, which loses the +@@ -28,6 +29,7 @@ test:detected_fish_shell() { + + test:detected_nu_shell() { + description "Test it can detect a nushell shell." ++ skip "This test fails in the Nix sandbox" + + # Note: We don't use bash's `-c` option when testing with a fake nu shell. + # Bash `-c` will automatically exec() into the last process, which loses the From 46e297cf987ef4fb1eb3b4eac1f978a4c2b80316 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Wed, 22 Oct 2025 13:40:04 +0200 Subject: [PATCH 4/4] bat-extras.batgrep: disable tests --- pkgs/tools/misc/bat-extras/modules/batgrep.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/tools/misc/bat-extras/modules/batgrep.nix b/pkgs/tools/misc/bat-extras/modules/batgrep.nix index 8ce898761c5b..72fc2ee8c076 100644 --- a/pkgs/tools/misc/bat-extras/modules/batgrep.nix +++ b/pkgs/tools/misc/bat-extras/modules/batgrep.nix @@ -11,5 +11,8 @@ buildBatExtrasPkg { coreutils ripgrep ]; + # The tests are broken with the new bat 0.26.0 + # https://github.com/eth-p/bat-extras/issues/143 + doCheck = false; meta.description = "Quickly search through and highlight files using ripgrep"; }