edit motivationcreating a modified NIXOS live CD out of a working nixos installation gives you the benefits:
edit how to build such an imagejust run this command: nix-build -A iso_minimal /etc/nixos/nixos/release.nix once the building process is over, there will be a path like this:
use this command: cat /nix/store/2y4bivmrzg4d2dgby2b7prvfj7445088-nixos-iso-0.1pre1234/nix-support/hydra-build-products file iso /nix/store/94rrfklbk2hcqhkr4627vsrlprlyva50-iso9660-image/iso/nixos-minimal-0.1pre1234-i686-linux-test.iso and copy the new image from there. edit adding additional software to the imagethe basic script /etc/nixos/nixos/release.nix contains several entry points for custom images. as we are using -A iso_minimal have a look at: iso_minimal which will redirect us to:
# This module defines a small NixOS installation CD. It does not
# contain any graphical stuff.
{config, pkgs, ...}:
{
require = [
./installation-cd-base.nix
../../profiles/minimal.nix
];
}
edit step 1/3: starting ssh automatically in the image and adding a ssh key to itsetting a default password on the boot cdrom (so that nobody can login using the default 'unset' password: TODO edit step 2/3: starting ssh automatically in the image and adding a ssh key to itthis is a hack, however it surely gives you an idea how to modify the stuff there: in /etc/nixos/nixos/modules/installer/cd-dvd/installation-cd-base.nix add: mkdir -p /root/.ssh/
echo 'ssh-rsa ssh-rsa AAAAB3Nz...(cut here)...AzV foo@bar' > /root/.ssh/authorized_keys
at the end of
edit step 3/3: starting ssh automatically in the image and adding a ssh key to itTHIS IS NOT WORKING YET: IGNORE LINES BELOW vi /etc/nixos/nixos/modules/installer/cd-dvd/system-tarball-pc.nix comment this line with a leading '#': jobs.openssh.startOn = "network interfaces started"; edit software installation inside the 'once' deployed and booted imagein case you have booted from your image you can add software as described here: Without NixOS you need to supply the source instead of /etc/nixos/nixos. edit references
|