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;
|
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
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -69,7 +80,7 @@ in
|
|||||||
|
|
||||||
system.build.manual = manual;
|
system.build.manual = manual;
|
||||||
|
|
||||||
environment.systemPackages = [ manual.manpages ];
|
environment.systemPackages = [ manual.manpages help ];
|
||||||
|
|
||||||
boot.extraTTYs = mkIf cfg.showManual ["tty${cfg.ttyNumber}"];
|
boot.extraTTYs = mkIf cfg.showManual ["tty${cfg.ttyNumber}"];
|
||||||
|
|
||||||
@ -78,7 +89,7 @@ in
|
|||||||
{ description = "NixOS Manual";
|
{ description = "NixOS Manual";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart = "${cfg.browser} ${manual.manual}/share/doc/nixos/manual.html";
|
{ ExecStart = "${cfg.browser} ${entry}";
|
||||||
StandardInput = "tty";
|
StandardInput = "tty";
|
||||||
StandardOutput = "tty";
|
StandardOutput = "tty";
|
||||||
TTYPath = "/dev/tty${cfg.ttyNumber}";
|
TTYPath = "/dev/tty${cfg.ttyNumber}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user