[Nix-dev] (Cross-)Building a custom installation CD
Sergey Mironov
grrwlf at gmail.com
Mon Jan 20 15:59:00 CET 2014
Hi. I need to create a custom installation CD to be able to install a
very minimalistic Linux system to a target device (an x86 server with
known set of hardware). Target OS should contain no multy-user
support, no plug-and-play and even no package manager. It's task is to
run one and only application, the mainapp. I suppose that main
installation script may be as simple as
installScript = ''
# format the hard disk
fdisk /dev/sda
# Mount the root partition
mount /dev/sda1 /mnt
# install everything
for p in ${linuxKernel} ${busybox} ${mainapp} /* etc */ ; do
cp -r $p /mnt
done
..
# generate the inittab which runs mainapp
..
grub /dev/sda
'';
Unfortunately, there is a complication: target device and developer
machines have different architectures (x86 via x86-64), plus we need a
custom (patched) gcc in order to build the mainapp. Ideally, I'd like
to cross-build the entire CD on the developer machines.
AFAIK, 'official' way of creating the installation CD is declared in
nixpkgs/nixos/modules/installer/cd-dvd/* rules. But I can't see a
connection between nixos and cross-build facilities described in [1].
Is it possible to provide nixpkgs/nixos with a different,
cross-compiled set of derivations to make it possible to configure
system as usual, but obtain an cross-built image as a result?
[1] - https://nixos.org/wiki/CrossCompiling
Regards,
Sergey
More information about the nix-dev
mailing list