2006-12-16 23:50:10 +00:00
|
|
|
*** Building the installation CD ***
|
2006-11-24 00:04:29 +00:00
|
|
|
|
2007-01-09 12:12:06 +00:00
|
|
|
(Or just grab an ISO from http://nix.cs.uu.nl/dist/nix/.)
|
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
- Make sure that you have a very recent Nix.
|
2006-11-24 00:04:29 +00:00
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
- Pull from the Nixpkgs channel to speed up building.
|
2006-11-24 00:04:29 +00:00
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
- Check out https://svn.cs.uu.nl:12443/repos/trace/nixos/trunk/.
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2007-01-09 12:12:06 +00:00
|
|
|
- Make a symbolic link called "pkgs" to the location of Nixpkgs.
|
2006-12-18 00:12:45 +00:00
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
- Build the ISO image:
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2007-01-04 10:31:36 +00:00
|
|
|
$ nix-build configuration/rescue-cd.nix -A rescueCD
|
2006-12-16 23:50:10 +00:00
|
|
|
|
|
|
|
This gives you an image in result/iso/nixos.iso.
|
|
|
|
|
|
|
|
- Burn the ISO image or attach it to a CD-ROM drive in VMware.
|
|
|
|
|
|
|
|
|
|
|
|
*** Installation ***
|
|
|
|
|
|
|
|
- Boot from the CD.
|
|
|
|
|
|
|
|
- The CD contains a pretty complete NixOS installation. When it's
|
|
|
|
finished booting, it should have detected most of your hardware and
|
|
|
|
brought up networking (check ifconfig). Networking is necessary for
|
|
|
|
the installer. It's best if you have a DHCP server on your
|
|
|
|
network. Otherwise configure manually.
|
|
|
|
|
|
|
|
- Login as "root", empty password.
|
|
|
|
|
|
|
|
- The NixOS installer doesn't do any partitioning or formatting yet,
|
2006-12-25 19:55:40 +00:00
|
|
|
so you need to that yourself. Use "fdisk", "mkfs.ext2" and "tune2fs".
|
2006-12-16 23:50:10 +00:00
|
|
|
|
2007-01-09 23:12:41 +00:00
|
|
|
- Mount the target root device, e.g., under /mnt.
|
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
- Unpack the NixOS and Nixpkgs sources:
|
|
|
|
|
|
|
|
$ tar xf /nixos.tar.bz2
|
|
|
|
$ tar xf /nixpkgs.tar.bz2
|
|
|
|
$ ln -s nixpkgs-*/pkgs .
|
|
|
|
|
|
|
|
(TODO: do this automatically.)
|
|
|
|
|
|
|
|
- The installation is declarative; you need to make a description of
|
|
|
|
the configuration that is to be built and activated. The
|
|
|
|
configuration is specified in a Nix expression. See
|
2007-01-04 10:31:36 +00:00
|
|
|
configuration/examples for example machine configurations. You can
|
|
|
|
copy and edit one of those (e.g., configuration/examples/basic.nix
|
|
|
|
to my-config.nix). See system/options.nix for available
|
2006-12-16 23:50:10 +00:00
|
|
|
configuration settings. The text editor "nano" is available.
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
In particular you need to specify boot.rootDevice and
|
|
|
|
boot.grubDevice for the devices where the OS and Grub are to be
|
|
|
|
installed, respectively.
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
- Do the installation:
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2007-02-06 10:46:36 +00:00
|
|
|
$ nixos-install.sh ROOTDIR . my-config.nix
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2007-01-09 23:12:41 +00:00
|
|
|
where ROOTDIR is the mount point of the target root device (i.e.,
|
|
|
|
boot.rootDevice in your configuration).
|
2006-12-16 23:50:10 +00:00
|
|
|
|
|
|
|
- If everything went well:
|
|
|
|
|
|
|
|
$ reboot
|
|
|
|
|
|
|
|
You should now be able to boot into the installed NixOS.
|
2007-01-09 14:57:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
*** Updating NixOS ***
|
|
|
|
|
|
|
|
- In NixOS, login as root, then do
|
|
|
|
|
|
|
|
$ checkout-nixos.sh # !!! should be added to the installation
|
|
|
|
|
|
|
|
This gives you a working copy of NixOS and NixPkgs in nixos/ and
|
|
|
|
nixpkgs/, respectively. You only need to do this once; you can use
|
|
|
|
"svn up" afterwards.
|
|
|
|
|
|
|
|
- The system configuration is in /etc/nixos/configuration.nix.
|
|
|
|
|
|
|
|
- To upgrade to a new configuration:
|
|
|
|
|
|
|
|
$ cd nixos
|
|
|
|
$ ./upgrade.sh
|
|
|
|
|
|
|
|
The new configuration is activated immediately (e.g., services may
|
|
|
|
be restarted if necessary), but some changes may require a reboot.
|
|
|
|
|
|
|
|
- You can also test a new configuration:
|
|
|
|
|
|
|
|
$ cd nixos
|
|
|
|
$ ./test.sh
|
|
|
|
|
|
|
|
This is like ./upgrade.sh, only the new configuration won't be
|
|
|
|
installed in the system profile so the system will continue to boot
|
|
|
|
from the previous configuration.
|
|
|
|
|
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
|
|
|
|
*** Troubleshooting ***
|
|
|
|
|
|
|
|
|
|
|
|
To get a Stage 1 shell:
|
|
|
|
|
|
|
|
- Add "debug1" to the kernel command line.
|
|
|
|
|
|
|
|
|
|
|
|
To switch to maintenance mode:
|
|
|
|
|
|
|
|
$ shutdown now
|
|
|
|
|
|
|
|
To get out of maintenance mode:
|
2006-11-23 22:53:25 +00:00
|
|
|
|
2006-12-16 23:50:10 +00:00
|
|
|
$ initctl emit startup
|
2007-01-10 12:29:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*** Development ***
|
|
|
|
|
|
|
|
- Building specific parts of NixOS:
|
|
|
|
|
|
|
|
$ nix-build system/system.nix \
|
|
|
|
--arg configuration "import /etc/nixos/configuration.nix" \
|
|
|
|
-A ATTR
|
|
|
|
|
|
|
|
where ATTR is an attribute in system/system.nix (e.g., bootStage1).
|
2007-02-05 15:12:47 +00:00
|
|
|
|
|
|
|
- Testing the installer:
|
|
|
|
|
2007-02-06 10:46:36 +00:00
|
|
|
$ nix-build configuration/rescue-cd.nix -A system.nixosInstall
|
2007-02-05 15:12:47 +00:00
|
|
|
$ dd if=/dev/zero of=diskimage seek=2G count=0 bs=1
|
|
|
|
$ yes | mke2fs -j diskimage
|
|
|
|
$ mount -o loop diskimage /mnt
|
2007-02-06 10:46:36 +00:00
|
|
|
$ ./result/bin/nixos-install
|
2007-02-05 15:12:47 +00:00
|
|
|
|