Manual: Explicitly mark commands that require to be run as root (#15589)
* manual: Mark commands that require root Mark every command that requires to be run as root by prefixing them with '#' instead of '$'. * manual: Add note about commands that require root
This commit is contained in:
parent
f547137425
commit
5f8d14546b
@ -21,7 +21,7 @@ Alternatively, you can use a systemd unit that does the same in the
|
|||||||
background:
|
background:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl start nix-gc.service
|
# systemctl start nix-gc.service
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
You can tell NixOS in <filename>configuration.nix</filename> to run
|
You can tell NixOS in <filename>configuration.nix</filename> to run
|
||||||
|
@ -13,7 +13,7 @@ create</literal>, it gets it own private IPv4 address in the range
|
|||||||
address as follows:
|
address as follows:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container show-ip foo
|
# nixos-container show-ip foo
|
||||||
10.233.4.2
|
10.233.4.2
|
||||||
|
|
||||||
$ ping -c1 10.233.4.2
|
$ ping -c1 10.233.4.2
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
identifier <literal>foo</literal> as follows:
|
identifier <literal>foo</literal> as follows:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container create foo
|
# nixos-container create foo
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
This creates the container’s root directory in
|
This creates the container’s root directory in
|
||||||
@ -25,7 +25,7 @@ line. For instance, to create a container that has
|
|||||||
<literal>root</literal>:
|
<literal>root</literal>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container create foo --config 'services.openssh.enable = true; \
|
# nixos-container create foo --config 'services.openssh.enable = true; \
|
||||||
users.extraUsers.root.openssh.authorizedKeys.keys = ["ssh-dss AAAAB3N…"];'
|
users.extraUsers.root.openssh.authorizedKeys.keys = ["ssh-dss AAAAB3N…"];'
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ $ nixos-container create foo --config 'services.openssh.enable = true; \
|
|||||||
run:
|
run:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container start foo
|
# nixos-container start foo
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
This command will return as soon as the container has booted and has
|
This command will return as soon as the container has booted and has
|
||||||
@ -46,7 +46,7 @@ Thus, if something went wrong, you can get status info using
|
|||||||
<command>systemctl</command>:
|
<command>systemctl</command>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl status container@foo
|
# systemctl status container@foo
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
@ -55,7 +55,7 @@ $ systemctl status container@foo
|
|||||||
root using the <command>root-login</command> operation:
|
root using the <command>root-login</command> operation:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container root-login foo
|
# nixos-container root-login foo
|
||||||
[root@foo:~]#
|
[root@foo:~]#
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ authentication). You can also get a regular login prompt using the
|
|||||||
the host:
|
the host:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container login foo
|
# nixos-container login foo
|
||||||
foo login: alice
|
foo login: alice
|
||||||
Password: ***
|
Password: ***
|
||||||
</screen>
|
</screen>
|
||||||
@ -74,7 +74,7 @@ With <command>nixos-container run</command>, you can execute arbitrary
|
|||||||
commands in the container:
|
commands in the container:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container run foo -- uname -a
|
# nixos-container run foo -- uname -a
|
||||||
Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux
|
Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
@ -86,17 +86,17 @@ container. First, on the host, you can edit
|
|||||||
and run
|
and run
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container update foo
|
# nixos-container update foo
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
This will build and activate the new configuration. You can also
|
This will build and activate the new configuration. You can also
|
||||||
specify a new configuration on the command line:
|
specify a new configuration on the command line:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container update foo --config 'services.httpd.enable = true; \
|
# nixos-container update foo --config 'services.httpd.enable = true; \
|
||||||
services.httpd.adminAddr = "foo@example.org";'
|
services.httpd.adminAddr = "foo@example.org";'
|
||||||
|
|
||||||
$ curl http://$(nixos-container show-ip foo)/
|
# curl http://$(nixos-container show-ip foo)/
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">…
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">…
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ start</literal>, respectively, or by using
|
|||||||
destroy a container, including its file system, do
|
destroy a container, including its file system, do
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-container destroy foo
|
# nixos-container destroy foo
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<para>You can enter rescue mode by running:
|
<para>You can enter rescue mode by running:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl rescue</screen>
|
# systemctl rescue</screen>
|
||||||
|
|
||||||
This will eventually give you a single-user root shell. Systemd will
|
This will eventually give you a single-user root shell. Systemd will
|
||||||
stop (almost) all system services. To get out of maintenance mode,
|
stop (almost) all system services. To get out of maintenance mode,
|
||||||
|
@ -18,14 +18,14 @@ You can disable the use of the binary cache by adding <option>--option
|
|||||||
use-binary-caches false</option>, e.g.
|
use-binary-caches false</option>, e.g.
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch --option use-binary-caches false
|
# nixos-rebuild switch --option use-binary-caches false
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
If you have an alternative binary cache at your disposal, you can use
|
If you have an alternative binary cache at your disposal, you can use
|
||||||
it instead:
|
it instead:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch --option binary-caches http://my-cache.example.org/
|
# nixos-rebuild switch --option binary-caches http://my-cache.example.org/
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
doing:
|
doing:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ shutdown
|
# shutdown
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
This is equivalent to running <command>systemctl
|
This is equivalent to running <command>systemctl
|
||||||
@ -19,7 +19,7 @@ poweroff</command>.</para>
|
|||||||
<para>To reboot the system, run
|
<para>To reboot the system, run
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ reboot
|
# reboot
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
which is equivalent to <command>systemctl reboot</command>.
|
which is equivalent to <command>systemctl reboot</command>.
|
||||||
@ -28,7 +28,7 @@ Alternatively, you can quickly reboot the system using
|
|||||||
the new kernel into memory:
|
the new kernel into memory:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl kexec
|
# systemctl kexec
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -19,7 +19,7 @@ fails to boot. After the system has booted, you can make the selected
|
|||||||
configuration the default for subsequent boots:
|
configuration the default for subsequent boots:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ /run/current-system/bin/switch-to-configuration boot</screen>
|
# /run/current-system/bin/switch-to-configuration boot</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@ -27,12 +27,12 @@ $ /run/current-system/bin/switch-to-configuration boot</screen>
|
|||||||
system:
|
system:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch --rollback</screen>
|
# nixos-rebuild switch --rollback</screen>
|
||||||
|
|
||||||
This is equivalent to running:
|
This is equivalent to running:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ /nix/var/nix/profiles/system-<replaceable>N</replaceable>-link/bin/switch-to-configuration switch</screen>
|
# /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
|
where <replaceable>N</replaceable> is the number of the NixOS system
|
||||||
configuration. To get a list of the available configurations, do:
|
configuration. To get a list of the available configurations, do:
|
||||||
|
@ -66,9 +66,9 @@ messages from the service.
|
|||||||
<para>Units can be stopped, started or restarted:
|
<para>Units can be stopped, started or restarted:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl stop postgresql.service
|
# systemctl stop postgresql.service
|
||||||
$ systemctl start postgresql.service
|
# systemctl start postgresql.service
|
||||||
$ systemctl restart postgresql.service
|
# systemctl restart postgresql.service
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
These operations are synchronous: they wait until the service has
|
These operations are synchronous: they wait until the service has
|
||||||
|
@ -18,7 +18,7 @@ you may be able to fix it automatically.</para>
|
|||||||
system configuration, you can fix it by doing
|
system configuration, you can fix it by doing
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch --repair
|
# nixos-rebuild switch --repair
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
This will cause Nix to check every path in the closure, and if its
|
This will cause Nix to check every path in the closure, and if its
|
||||||
@ -28,7 +28,7 @@ the path is rebuilt or redownloaded.</para>
|
|||||||
<para>You can also scan the entire Nix store for corrupt paths:
|
<para>You can also scan the entire Nix store for corrupt paths:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-store --verify --check-contents --repair
|
# nix-store --verify --check-contents --repair
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
Any corrupt paths will be redownloaded if they’re available in a
|
Any corrupt paths will be redownloaded if they’re available in a
|
||||||
|
@ -45,7 +45,7 @@ track of this, you can terminate a session in a way that ensures that
|
|||||||
all the session’s processes are gone:
|
all the session’s processes are gone:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ loginctl terminate-session c3
|
# loginctl terminate-session c3
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -31,7 +31,7 @@ and you run <command>nixos-rebuild</command>, specifying your own
|
|||||||
Nixpkgs tree:
|
Nixpkgs tree:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs</screen>
|
# nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ $ nix-shell '<nixpkgs>' -A linuxPackages.kernel
|
|||||||
$ unpackPhase
|
$ unpackPhase
|
||||||
$ cd linux-*
|
$ cd linux-*
|
||||||
$ make -C $dev/lib/modules/*/build M=$(pwd)/drivers/net/ethernet/mellanox modules
|
$ make -C $dev/lib/modules/*/build M=$(pwd)/drivers/net/ethernet/mellanox modules
|
||||||
$ sudo insmod ./drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko
|
# insmod ./drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko
|
||||||
]]></screen>
|
]]></screen>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -12,7 +12,7 @@ here is how you create an encrypted Ext4 file system on the device
|
|||||||
<filename>/dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d</filename>:
|
<filename>/dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d</filename>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ cryptsetup luksFormat /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d
|
# cryptsetup luksFormat /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d
|
||||||
|
|
||||||
WARNING!
|
WARNING!
|
||||||
========
|
========
|
||||||
@ -22,10 +22,10 @@ Are you sure? (Type uppercase yes): YES
|
|||||||
Enter LUKS passphrase: ***
|
Enter LUKS passphrase: ***
|
||||||
Verify passphrase: ***
|
Verify passphrase: ***
|
||||||
|
|
||||||
$ cryptsetup luksOpen /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d crypted
|
# cryptsetup luksOpen /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d crypted
|
||||||
Enter passphrase for /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d: ***
|
Enter passphrase for /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d: ***
|
||||||
|
|
||||||
$ mkfs.ext4 /dev/mapper/crypted
|
# mkfs.ext4 /dev/mapper/crypted
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
To ensure that this file system is automatically mounted at boot time
|
To ensure that this file system is automatically mounted at boot time
|
||||||
|
@ -63,14 +63,14 @@ commands such as <command>useradd</command>,
|
|||||||
account named <literal>alice</literal>:
|
account named <literal>alice</literal>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ useradd -m alice</screen>
|
# useradd -m alice</screen>
|
||||||
|
|
||||||
To make all nix tools available to this new user use `su - USER` which
|
To make all nix tools available to this new user use `su - USER` which
|
||||||
opens a login shell (==shell that loads the profile) for given user.
|
opens a login shell (==shell that loads the profile) for given user.
|
||||||
This will create the ~/.nix-defexpr symlink. So run:
|
This will create the ~/.nix-defexpr symlink. So run:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ su - alice -c "true"</screen>
|
# su - alice -c "true"</screen>
|
||||||
|
|
||||||
|
|
||||||
The flag <option>-m</option> causes the creation of a home directory
|
The flag <option>-m</option> causes the creation of a home directory
|
||||||
@ -79,7 +79,7 @@ have an initial password and therefore cannot log in. A password can
|
|||||||
be set using the <command>passwd</command> utility:
|
be set using the <command>passwd</command> utility:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ passwd alice
|
# passwd alice
|
||||||
Enter new UNIX password: ***
|
Enter new UNIX password: ***
|
||||||
Retype new UNIX password: ***
|
Retype new UNIX password: ***
|
||||||
</screen>
|
</screen>
|
||||||
@ -87,7 +87,7 @@ Retype new UNIX password: ***
|
|||||||
A user can be deleted using <command>userdel</command>:
|
A user can be deleted using <command>userdel</command>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ userdel -r alice</screen>
|
# userdel -r alice</screen>
|
||||||
|
|
||||||
The flag <option>-r</option> deletes the user’s home directory.
|
The flag <option>-r</option> deletes the user’s home directory.
|
||||||
Accounts can be modified using <command>usermod</command>. Unix
|
Accounts can be modified using <command>usermod</command>. Unix
|
||||||
|
@ -41,13 +41,13 @@ If you are using WPA2 the <command>wpa_passphrase</command> tool might be useful
|
|||||||
to generate the <literal>wpa_supplicant.conf</literal>.
|
to generate the <literal>wpa_supplicant.conf</literal>.
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf</screen>
|
# wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf</screen>
|
||||||
|
|
||||||
After you have edited the <literal>wpa_supplicant.conf</literal>,
|
After you have edited the <literal>wpa_supplicant.conf</literal>,
|
||||||
you need to restart the wpa_supplicant service.
|
you need to restart the wpa_supplicant service.
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl restart wpa_supplicant.service</screen>
|
# systemctl restart wpa_supplicant.service</screen>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -48,7 +48,7 @@ services.xserver.autorun = false;
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
The X server can then be started manually:
|
The X server can then be started manually:
|
||||||
<screen>
|
<screen>
|
||||||
$ systemctl start display-manager.service
|
# systemctl start display-manager.service
|
||||||
</screen>
|
</screen>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ $ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd
|
|||||||
suggested by the following command:
|
suggested by the following command:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso</screen>
|
# mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ $ nix-build -A 'config.systemd.units."httpd.service".unit'
|
|||||||
<screen>
|
<screen>
|
||||||
$ cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
|
$ cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
|
||||||
/run/systemd/system/tmp-httpd.service
|
/run/systemd/system/tmp-httpd.service
|
||||||
$ systemctl daemon-reload
|
# systemctl daemon-reload
|
||||||
$ systemctl start tmp-httpd.service
|
# systemctl start tmp-httpd.service
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
Note that the unit must not have the same name as any unit in
|
Note that the unit must not have the same name as any unit in
|
||||||
|
@ -70,7 +70,7 @@ sources, you need to tell <command>nixos-rebuild</command> about them
|
|||||||
using the <option>-I</option> flag:
|
using the <option>-I</option> flag:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch -I nixpkgs=<replaceable>/my/sources</replaceable>/nixpkgs
|
# nixos-rebuild switch -I nixpkgs=<replaceable>/my/sources</replaceable>/nixpkgs
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -12,14 +12,14 @@ properly:
|
|||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-build -A config.system.build.nixos-install
|
$ nix-build -A config.system.build.nixos-install
|
||||||
$ mount -t tmpfs none /mnt
|
# mount -t tmpfs none /mnt
|
||||||
$ ./result/bin/nixos-install</screen>
|
# ./result/bin/nixos-install</screen>
|
||||||
|
|
||||||
To start a login shell in the new NixOS installation in
|
To start a login shell in the new NixOS installation in
|
||||||
<filename>/mnt</filename>:
|
<filename>/mnt</filename>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ ./result/bin/nixos-install --chroot
|
# ./result/bin/nixos-install --chroot
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -10,7 +10,7 @@ contains the current configuration of your machine. Whenever you’ve
|
|||||||
changed something to that file, you should do
|
changed something to that file, you should do
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch</screen>
|
# nixos-rebuild switch</screen>
|
||||||
|
|
||||||
to build the new configuration, make it the default configuration for
|
to build the new configuration, make it the default configuration for
|
||||||
booting, and try to realise the configuration in the running system
|
booting, and try to realise the configuration in the running system
|
||||||
@ -23,7 +23,7 @@ either run them from a root shell or by prefixing them with
|
|||||||
<para>You can also do
|
<para>You can also do
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild test</screen>
|
# nixos-rebuild test</screen>
|
||||||
|
|
||||||
to build the configuration and switch the running system to it, but
|
to build the configuration and switch the running system to it, but
|
||||||
without making it the boot default. So if (say) the configuration
|
without making it the boot default. So if (say) the configuration
|
||||||
@ -33,7 +33,7 @@ configuration.</para>
|
|||||||
<para>There is also
|
<para>There is also
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild boot</screen>
|
# nixos-rebuild boot</screen>
|
||||||
|
|
||||||
to build the configuration and make it the boot default, but not
|
to build the configuration and make it the boot default, but not
|
||||||
switch to it now (so it will only take effect after the next
|
switch to it now (so it will only take effect after the next
|
||||||
@ -44,7 +44,7 @@ of the GRUB 2 boot screen by giving it a different <emphasis>profile
|
|||||||
name</emphasis>, e.g.
|
name</emphasis>, e.g.
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch -p test </screen>
|
# nixos-rebuild switch -p test </screen>
|
||||||
|
|
||||||
which causes the new configuration (and previous ones created using
|
which causes the new configuration (and previous ones created using
|
||||||
<literal>-p test</literal>) to show up in the GRUB submenu “NixOS -
|
<literal>-p test</literal>) to show up in the GRUB submenu “NixOS -
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
changes. For example:
|
changes. For example:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ mkfs.ext4 -L nixos /dev/sda1</screen>
|
# mkfs.ext4 -L nixos /dev/sda1</screen>
|
||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
@ -66,10 +66,10 @@ $ mkfs.ext4 -L nixos /dev/sda1</screen>
|
|||||||
<listitem><para>For creating LVM volumes, the LVM commands, e.g.,
|
<listitem><para>For creating LVM volumes, the LVM commands, e.g.,
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ pvcreate /dev/sda1 /dev/sdb1
|
# pvcreate /dev/sda1 /dev/sdb1
|
||||||
$ vgcreate MyVolGroup /dev/sda1 /dev/sdb1
|
# vgcreate MyVolGroup /dev/sda1 /dev/sdb1
|
||||||
$ lvcreate --size 2G --name bigdisk MyVolGroup
|
# lvcreate --size 2G --name bigdisk MyVolGroup
|
||||||
$ lvcreate --size 1G --name smalldisk MyVolGroup</screen>
|
# lvcreate --size 1G --name smalldisk MyVolGroup</screen>
|
||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ $ lvcreate --size 1G --name smalldisk MyVolGroup</screen>
|
|||||||
be installed on <filename>/mnt</filename>, e.g.
|
be installed on <filename>/mnt</filename>, e.g.
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ mount /dev/disk/by-label/nixos /mnt
|
# mount /dev/disk/by-label/nixos /mnt
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
@ -113,14 +113,14 @@ $ mount /dev/disk/by-label/nixos /mnt
|
|||||||
generate an initial configuration file for you:
|
generate an initial configuration file for you:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-generate-config --root /mnt</screen>
|
# nixos-generate-config --root /mnt</screen>
|
||||||
|
|
||||||
You should then edit
|
You should then edit
|
||||||
<filename>/mnt/etc/nixos/configuration.nix</filename> to suit your
|
<filename>/mnt/etc/nixos/configuration.nix</filename> to suit your
|
||||||
needs:
|
needs:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nano /mnt/etc/nixos/configuration.nix
|
# nano /mnt/etc/nixos/configuration.nix
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
If you’re using the graphical ISO image, other editors may be
|
If you’re using the graphical ISO image, other editors may be
|
||||||
@ -162,7 +162,7 @@ $ nano /mnt/etc/nixos/configuration.nix
|
|||||||
<listitem><para>Do the installation:
|
<listitem><para>Do the installation:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-install</screen>
|
# nixos-install</screen>
|
||||||
|
|
||||||
Cross fingers. If this fails due to a temporary problem (such as
|
Cross fingers. If this fails due to a temporary problem (such as
|
||||||
a network issue while downloading binaries from the NixOS binary
|
a network issue while downloading binaries from the NixOS binary
|
||||||
@ -186,7 +186,7 @@ Retype new UNIX password: ***
|
|||||||
<listitem><para>If everything went well:
|
<listitem><para>If everything went well:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ reboot</screen>
|
# reboot</screen>
|
||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
@ -235,15 +235,15 @@ drive (here <filename>/dev/sda</filename>). <xref linkend="ex-config"
|
|||||||
|
|
||||||
<example xml:id='ex-install-sequence'><title>Commands for Installing NixOS on <filename>/dev/sda</filename></title>
|
<example xml:id='ex-install-sequence'><title>Commands for Installing NixOS on <filename>/dev/sda</filename></title>
|
||||||
<screen>
|
<screen>
|
||||||
$ fdisk /dev/sda # <lineannotation>(or whatever device you want to install on)</lineannotation>
|
# fdisk /dev/sda # <lineannotation>(or whatever device you want to install on)</lineannotation>
|
||||||
$ mkfs.ext4 -L nixos /dev/sda1
|
# mkfs.ext4 -L nixos /dev/sda1
|
||||||
$ mkswap -L swap /dev/sda2
|
# mkswap -L swap /dev/sda2
|
||||||
$ swapon /dev/sda2
|
# swapon /dev/sda2
|
||||||
$ mount /dev/disk/by-label/nixos /mnt
|
# mount /dev/disk/by-label/nixos /mnt
|
||||||
$ nixos-generate-config --root /mnt
|
# nixos-generate-config --root /mnt
|
||||||
$ nano /mnt/etc/nixos/configuration.nix
|
# nano /mnt/etc/nixos/configuration.nix
|
||||||
$ nixos-install
|
# nixos-install
|
||||||
$ reboot</screen>
|
# reboot</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example xml:id='ex-config'><title>NixOS Configuration</title>
|
<example xml:id='ex-config'><title>NixOS Configuration</title>
|
||||||
|
@ -60,33 +60,33 @@ the <literal>nixos-14.12</literal> channel. To see which NixOS
|
|||||||
channel you’re subscribed to, run the following as root:
|
channel you’re subscribed to, run the following as root:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --list | grep nixos
|
# nix-channel --list | grep nixos
|
||||||
nixos https://nixos.org/channels/nixos-unstable
|
nixos https://nixos.org/channels/nixos-unstable
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
To switch to a different NixOS channel, do
|
To switch to a different NixOS channel, do
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --add https://nixos.org/channels/<replaceable>channel-name</replaceable> nixos
|
# nix-channel --add https://nixos.org/channels/<replaceable>channel-name</replaceable> nixos
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
(Be sure to include the <literal>nixos</literal> parameter at the
|
(Be sure to include the <literal>nixos</literal> parameter at the
|
||||||
end.) For instance, to use the NixOS 14.12 stable channel:
|
end.) For instance, to use the NixOS 14.12 stable channel:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --add https://nixos.org/channels/nixos-14.12 nixos
|
# nix-channel --add https://nixos.org/channels/nixos-14.12 nixos
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
If you have a server, you may want to use the “small” channel instead:
|
If you have a server, you may want to use the “small” channel instead:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --add https://nixos.org/channels/nixos-14.12-small nixos
|
# nix-channel --add https://nixos.org/channels/nixos-14.12-small nixos
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
And if you want to live on the bleeding edge:
|
And if you want to live on the bleeding edge:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
# nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
@ -95,7 +95,7 @@ $ nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
|||||||
channel by running
|
channel by running
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nixos-rebuild switch --upgrade
|
# nixos-rebuild switch --upgrade
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
which is equivalent to the more verbose <literal>nix-channel --update
|
which is equivalent to the more verbose <literal>nix-channel --update
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
xlink:href="https://github.com/NixOS/nixpkgs/issues">NixOS’ GitHub
|
xlink:href="https://github.com/NixOS/nixpkgs/issues">NixOS’ GitHub
|
||||||
issue tracker</link>.</para>
|
issue tracker</link>.</para>
|
||||||
|
|
||||||
|
<note>Commands prefixed with <literal>#</literal> have to be run as
|
||||||
|
root, either requiring to login as root user or temporarily switching
|
||||||
|
to it using <literal>sudo</literal> for example.</note>
|
||||||
</preface>
|
</preface>
|
||||||
|
|
||||||
<xi:include href="installation/installation.xml" />
|
<xi:include href="installation/installation.xml" />
|
||||||
|
Loading…
Reference in New Issue
Block a user