From 36349274d710d37abdca49dd5b3612091738722a Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Tue, 3 Feb 2026 15:03:45 +0100 Subject: [PATCH] home-manager: Prevent pipe failure when reading news On my system (Fedora 43 with Nix 2.31.3) `home-manager news` exits from `SIGPIPE` and never writes `~/.local/share/home-manager/news-read-ids`, resulting in news items to never be marked read. This is caused by piping `(import ./news.nix).news.all` through `jq` and `less` failing with an error as soon as `less` exits, which triggers `set -o pipefail` to exit the shell running `home-manager` itself. Avoiding the pipe into `$PAGER` avoids the problem. Closes: https://github.com/nix-community/home-manager/issues/8690 References: https://github.com/jqlang/jq/issues/1017 References: https://www.greenend.org.uk/rjk/tech/shellmistakes.html#pipeerrors --- home-manager/home-manager | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index 569a5642..6f9f3907 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -998,9 +998,11 @@ function doShowNews() { return 1 esac + local formattedNewsFile="$WORK_DIR/news.txt" nix-instantiate --quiet --eval --json --expr "(import ${newsNixFile}).news.$newsAttr" \ | jq -r . \ - | ${PAGER:-less} + > "$formattedNewsFile" + ${PAGER:-less} "$formattedNewsFile" local allIds allIds="$(nix-instantiate --quiet --eval --expr "(import ${newsNixFile}).meta.ids")"