Merge pull request #45911 from samueldr/fix/nixos-help-browser

nixos/manual: nixos-help knows about colon-separated BROWSER

Changed files
+7 -1
nixos
modules
services
+7 -1
nixos/modules/services/misc/nixos-manual.nix
···
helpScript = pkgs.writeScriptBin "nixos-help"
''
#! ${pkgs.runtimeShell} -e
-
browser="$BROWSER"
if [ -z "$browser" ]; then
browser="$(type -P xdg-open || true)"
if [ -z "$browser" ]; then
···
helpScript = pkgs.writeScriptBin "nixos-help"
''
#! ${pkgs.runtimeShell} -e
+
# Finds first executable browser in a colon-separated list.
+
# (see how xdg-open defines BROWSER)
+
browser="$(
+
IFS=: ; for b in $BROWSER; do
+
[ -n "$(type -P "$b" || true)" ] && echo "$b" && break
+
done
+
)"
if [ -z "$browser" ]; then
browser="$(type -P xdg-open || true)"
if [ -z "$browser" ]; then