2023-12-09 19:03:58 +00:00
|
|
|
{
|
|
|
|
writeShellScriptBin,
|
|
|
|
makeDesktopItem,
|
|
|
|
symlinkJoin,
|
|
|
|
html,
|
|
|
|
}: let
|
2024-09-22 19:52:10 +00:00
|
|
|
helpScript = writeShellScriptBin "nvf-help" ''
|
2023-12-09 19:03:58 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
|
|
|
for candidate in xdg-open open w3m; do
|
|
|
|
BROWSER="$(type -P $candidate || true)"
|
|
|
|
if [[ -x $BROWSER ]]; then
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
|
|
|
echo "$0: unable to start a web browser; please set \$BROWSER"
|
|
|
|
exit 1
|
|
|
|
else
|
2024-09-22 19:52:10 +00:00
|
|
|
exec "$BROWSER" "${html}/share/doc/nvf/index.xhtml"
|
2023-12-09 19:03:58 +00:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
2024-09-22 19:52:10 +00:00
|
|
|
name = "nvf-manual";
|
|
|
|
desktopName = "nvf Manual";
|
|
|
|
genericName = "View nvf documentation in a web browser";
|
2023-12-09 19:03:58 +00:00
|
|
|
icon = "nix-snowflake";
|
2024-09-22 19:52:10 +00:00
|
|
|
exec = "${helpScript}/bin/nvf-help";
|
2023-12-09 19:03:58 +00:00
|
|
|
categories = ["System"];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
symlinkJoin {
|
2024-09-22 19:52:10 +00:00
|
|
|
name = "nvf-help";
|
|
|
|
paths = [
|
|
|
|
helpScript
|
|
|
|
desktopItem
|
|
|
|
];
|
2023-12-09 19:03:58 +00:00
|
|
|
}
|