Add a command ‘nixos-help’ that opens the NixOS manual in a browser
This commit is contained in:
parent
f05e5813b5
commit
81796c5baf
|
@ -16,6 +16,17 @@ let
|
|||
inherit pkgs options;
|
||||
};
|
||||
|
||||
entry = "${manual.manual}/share/doc/nixos/manual.html";
|
||||
|
||||
help = pkgs.writeScriptBin "nixos-help"
|
||||
''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
if ! ''${BROWSER:-w3m} ${entry}; then
|
||||
echo "$0: unable to start a web browser; please set \$BROWSER or install ‘w3m’"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -69,7 +80,7 @@ in
|
|||
|
||||
system.build.manual = manual;
|
||||
|
||||
environment.systemPackages = [ manual.manpages ];
|
||||
environment.systemPackages = [ manual.manpages help ];
|
||||
|
||||
boot.extraTTYs = mkIf cfg.showManual ["tty${cfg.ttyNumber}"];
|
||||
|
||||
|
@ -78,7 +89,7 @@ in
|
|||
{ description = "NixOS Manual";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig =
|
||||
{ ExecStart = "${cfg.browser} ${manual.manual}/share/doc/nixos/manual.html";
|
||||
{ ExecStart = "${cfg.browser} ${entry}";
|
||||
StandardInput = "tty";
|
||||
StandardOutput = "tty";
|
||||
TTYPath = "/dev/tty${cfg.ttyNumber}";
|
||||
|
|
Loading…
Reference in New Issue