summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-09-02 14:30:22 -0400
committerGitHub <noreply@github.com>2018-09-02 14:30:22 -0400
commit146f8bac7e9e7d614b23ecdc457f14c59622c8d1 (patch)
tree37372092f6e16e29f81f12eb145d74b001b1d668
parentf14b6cb6ecd9b1a41e5cd939efeb966f612e4b07 (diff)
parent4ff5f304b9db4a85ad5da67cbcae8802fd574bcb (diff)
downloadnixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.tar
nixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.tar.gz
nixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.tar.bz2
nixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.tar.lz
nixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.tar.xz
nixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.tar.zst
nixlib-146f8bac7e9e7d614b23ecdc457f14c59622c8d1.zip
Merge pull request #45911 from samueldr/fix/nixos-help-browser
nixos/manual: nixos-help knows about colon-separated BROWSER
-rw-r--r--nixos/modules/services/misc/nixos-manual.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 3916c3052e8b..993b59590bb0 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -44,7 +44,13 @@ let
   helpScript = pkgs.writeScriptBin "nixos-help"
     ''
       #! ${pkgs.runtimeShell} -e
-      browser="$BROWSER"
+      # 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