diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2020-09-23 00:38:47 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2020-09-23 01:25:25 +0200 |
commit | e6ce041caef09405283081a8b5c5412153eccc85 (patch) | |
tree | 048f15ef23b9a4ab1d7741cfb64f7c355753c082 /nixos/doc/manual/administration | |
parent | e1af37634b387e18361f15b2db1c7f7f93d37ebc (diff) |
nixos/doc: Improve code listings
By adding prompts and replaceables and removing unnecessary indentation.
Diffstat (limited to 'nixos/doc/manual/administration')
7 files changed, 29 insertions, 29 deletions
diff --git a/nixos/doc/manual/administration/imperative-containers.xml b/nixos/doc/manual/administration/imperative-containers.xml index 435ed230f5133..bc19acf9f6908 100644 --- a/nixos/doc/manual/administration/imperative-containers.xml +++ b/nixos/doc/manual/administration/imperative-containers.xml @@ -14,18 +14,18 @@ <para> You create a container with identifier <literal>foo</literal> as follows: <screen> -# nixos-container create foo +<prompt># </prompt>nixos-container create <replaceable>foo</replaceable> </screen> This creates the container’s root directory in - <filename>/var/lib/containers/foo</filename> and a small configuration file - in <filename>/etc/containers/foo.conf</filename>. It also builds the + <filename>/var/lib/containers/<replaceable>foo</replaceable></filename> and a small configuration file + in <filename>/etc/containers/<replaceable>foo</replaceable>.conf</filename>. It also builds the container’s initial system configuration and stores it in - <filename>/nix/var/nix/profiles/per-container/foo/system</filename>. You can + <filename>/nix/var/nix/profiles/per-container/<replaceable>foo</replaceable>/system</filename>. You can modify the initial configuration of the container on the command line. For instance, to create a container that has <command>sshd</command> running, with the given public key for <literal>root</literal>: <screen> -# nixos-container create foo --config ' +<prompt># </prompt>nixos-container create <replaceable>foo</replaceable> --config ' <xref linkend="opt-services.openssh.enable"/> = true; <link linkend="opt-users.users._name_.openssh.authorizedKeys.keys">users.users.root.openssh.authorizedKeys.keys</link> = ["ssh-dss AAAAB3N…"]; ' @@ -34,7 +34,7 @@ as container IP. This behavior can be altered by setting <literal>--host-address</literal> and <literal>--local-address</literal>: <screen> -# nixos-container create test --config-file test-container.nix \ +<prompt># </prompt>nixos-container create test --config-file test-container.nix \ --local-address 10.235.1.2 --host-address 10.235.1.1 </screen> </para> @@ -42,7 +42,7 @@ <para> Creating a container does not start it. To start the container, run: <screen> -# nixos-container start foo +<prompt># </prompt>nixos-container start <replaceable>foo</replaceable> </screen> This command will return as soon as the container has booted and has reached <literal>multi-user.target</literal>. On the host, the container runs within @@ -51,7 +51,7 @@ Thus, if something went wrong, you can get status info using <command>systemctl</command>: <screen> -# systemctl status container@foo +<prompt># </prompt>systemctl status container@<replaceable>foo</replaceable> </screen> </para> @@ -59,22 +59,22 @@ If the container has started successfully, you can log in as root using the <command>root-login</command> operation: <screen> -# nixos-container root-login foo -[root@foo:~]# +<prompt># </prompt>nixos-container root-login <replaceable>foo</replaceable> +<prompt>[root@foo:~]#</prompt> </screen> Note that only root on the host can do this (since there is no authentication). You can also get a regular login prompt using the <command>login</command> operation, which is available to all users on the host: <screen> -# nixos-container login foo +<prompt># </prompt>nixos-container login <replaceable>foo</replaceable> foo login: alice Password: *** </screen> With <command>nixos-container run</command>, you can execute arbitrary commands in the container: <screen> -# nixos-container run foo -- uname -a +<prompt># </prompt>nixos-container run <replaceable>foo</replaceable> -- uname -a Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux </screen> </para> @@ -85,18 +85,18 @@ Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux <literal>/var/lib/container/<replaceable>name</replaceable>/etc/nixos/configuration.nix</literal>, and run <screen> -# nixos-container update foo +<prompt># </prompt>nixos-container update <replaceable>foo</replaceable> </screen> This will build and activate the new configuration. You can also specify a new configuration on the command line: <screen> -# nixos-container update foo --config ' +<prompt># </prompt>nixos-container update <replaceable>foo</replaceable> --config ' <xref linkend="opt-services.httpd.enable"/> = true; <xref linkend="opt-services.httpd.adminAddr"/> = "foo@example.org"; <xref linkend="opt-networking.firewall.allowedTCPPorts"/> = [ 80 ]; ' -# curl http://$(nixos-container show-ip foo)/ +<prompt># </prompt>curl http://$(nixos-container show-ip <replaceable>foo</replaceable>)/ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">… </screen> However, note that this will overwrite the container’s @@ -117,7 +117,7 @@ Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux by using <command>systemctl</command> on the container’s service unit. To destroy a container, including its file system, do <screen> -# nixos-container destroy foo +<prompt># </prompt>nixos-container destroy <replaceable>foo</replaceable> </screen> </para> </section> diff --git a/nixos/doc/manual/administration/maintenance-mode.xml b/nixos/doc/manual/administration/maintenance-mode.xml index 71e3f9ea665d8..74abfdd7c6634 100644 --- a/nixos/doc/manual/administration/maintenance-mode.xml +++ b/nixos/doc/manual/administration/maintenance-mode.xml @@ -8,7 +8,7 @@ <para> You can enter rescue mode by running: <screen> -# systemctl rescue</screen> +<prompt># </prompt>systemctl rescue</screen> This will eventually give you a single-user root shell. Systemd will stop (almost) all system services. To get out of maintenance mode, just exit from the rescue shell. diff --git a/nixos/doc/manual/administration/network-problems.xml b/nixos/doc/manual/administration/network-problems.xml index 570f58358845b..1035e4e056a94 100644 --- a/nixos/doc/manual/administration/network-problems.xml +++ b/nixos/doc/manual/administration/network-problems.xml @@ -16,12 +16,12 @@ disable the use of the binary cache by adding <option>--option use-binary-caches false</option>, e.g. <screen> -# nixos-rebuild switch --option use-binary-caches false +<prompt># </prompt>nixos-rebuild switch --option use-binary-caches false </screen> If you have an alternative binary cache at your disposal, you can use it instead: <screen> -# nixos-rebuild switch --option binary-caches http://my-cache.example.org/ +<prompt># </prompt>nixos-rebuild switch --option binary-caches <replaceable>http://my-cache.example.org/</replaceable> </screen> </para> </section> diff --git a/nixos/doc/manual/administration/rebooting.xml b/nixos/doc/manual/administration/rebooting.xml index a5abd6f025885..c57d885c5f3cc 100644 --- a/nixos/doc/manual/administration/rebooting.xml +++ b/nixos/doc/manual/administration/rebooting.xml @@ -7,20 +7,20 @@ <para> The system can be shut down (and automatically powered off) by doing: <screen> -# shutdown +<prompt># </prompt>shutdown </screen> This is equivalent to running <command>systemctl poweroff</command>. </para> <para> To reboot the system, run <screen> -# reboot +<prompt># </prompt>reboot </screen> which is equivalent to <command>systemctl reboot</command>. Alternatively, you can quickly reboot the system using <literal>kexec</literal>, which bypasses the BIOS by directly loading the new kernel into memory: <screen> -# systemctl kexec +<prompt># </prompt>systemctl kexec </screen> </para> <para> diff --git a/nixos/doc/manual/administration/rollback.xml b/nixos/doc/manual/administration/rollback.xml index fb87810ba4612..80d79e1a53f15 100644 --- a/nixos/doc/manual/administration/rollback.xml +++ b/nixos/doc/manual/administration/rollback.xml @@ -20,16 +20,16 @@ has booted, you can make the selected configuration the default for subsequent boots: <screen> -# /run/current-system/bin/switch-to-configuration boot</screen> +<prompt># </prompt>/run/current-system/bin/switch-to-configuration boot</screen> </para> <para> Second, you can switch to the previous configuration in a running system: <screen> -# nixos-rebuild switch --rollback</screen> +<prompt># </prompt>nixos-rebuild switch --rollback</screen> This is equivalent to running: <screen> -# /nix/var/nix/profiles/system-<replaceable>N</replaceable>-link/bin/switch-to-configuration switch</screen> +<prompt># </prompt>/nix/var/nix/profiles/system-<replaceable>N</replaceable>-link/bin/switch-to-configuration switch</screen> where <replaceable>N</replaceable> is the number of the NixOS system configuration. To get a list of the available configurations, do: <screen> diff --git a/nixos/doc/manual/administration/service-mgmt.xml b/nixos/doc/manual/administration/service-mgmt.xml index 1b9c745eb59f6..1c5d48a5bcf07 100644 --- a/nixos/doc/manual/administration/service-mgmt.xml +++ b/nixos/doc/manual/administration/service-mgmt.xml @@ -58,9 +58,9 @@ Jan 07 15:55:57 hagbard systemd[1]: Started PostgreSQL Server. <para> Units can be stopped, started or restarted: <screen> -# systemctl stop postgresql.service -# systemctl start postgresql.service -# systemctl restart postgresql.service +<prompt># </prompt>systemctl stop postgresql.service +<prompt># </prompt>systemctl start postgresql.service +<prompt># </prompt>systemctl restart postgresql.service </screen> These operations are synchronous: they wait until the service has finished starting or stopping (or has failed). Starting a unit will cause the diff --git a/nixos/doc/manual/administration/user-sessions.xml b/nixos/doc/manual/administration/user-sessions.xml index 80daf6bdbff0b..9acb147ac1a68 100644 --- a/nixos/doc/manual/administration/user-sessions.xml +++ b/nixos/doc/manual/administration/user-sessions.xml @@ -39,7 +39,7 @@ c3 - root (0) can terminate a session in a way that ensures that all the session’s processes are gone: <screen> -# loginctl terminate-session c3 +<prompt># </prompt>loginctl terminate-session c3 </screen> </para> </chapter> |