Added closed-install example of configurable Live DVD. Tested: virtual network of two QEmu-s, one is booted from that LiveDVD, another executes one scripted process and forces first to install NixOS.

svn path=/nixos/trunk/; revision=11816
This commit is contained in:
Michael Raskin 2008-05-12 07:12:18 +00:00
parent cc7f3c7aaa
commit 1a6e1a43dc
3 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,57 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
in
(isoFun {
inherit platform;
lib = (import ../pkgs/lib);
networkNixpkgs = "";
manualEnabled = true;
rogueEnabled = false;
sshdEnabled = true;
fontConfigEnabled = false;
sudoEnable = true;
includeMemtest = false;
includeStdenv = true;
includeBuildDeps = true;
/*
If anyone uses that DVD on live
computer, use DHCP; but also add
a rogue address for tests in virtual
networks without DHCP at all.
*/
addIP = "10.0.253.251";
netmask = "255.255.0.0";
kernel = pkgs: (
pkgs.aggregateModules
[pkgs.kernel]
);
packages = pkgs : [
pkgs.patch
pkgs.irssi
pkgs.subversion
pkgs.w3m
pkgs.utillinuxCurses
pkgs.wpa_supplicant
pkgs.emacs
pkgs.vimHugeX
];
/*
The goal is remotely controlled
installation (maybe over virtual
networking with QEmu without human
interaction), so let's make ssh
work without manual password entry
*/
additionalFiles = [
{
source = /var/certs/ssh/id_livedvd.pub;
target = "/root/.ssh/authorized_keys";
}
];
}).rescueCD

View File

@ -0,0 +1,32 @@
{
boot = {
grubDevice = "/dev/sda";
copyKernels = true;
bootMount = "(hd0,0)";
};
fileSystems = [
{ mountPoint = "/";
device = "/dev/sda3";
}
{ mountPoint = "/boot";
device = "/dev/sda1";
neededForBoot = true;
}
];
swapDevices = [
{ device = "/dev/sda2"; }
];
services = {
sshd = {
enable = true;
};
};
fonts = {
enableFontConfig = false;
};
}

View File

@ -24,6 +24,20 @@
*/
,configList ? (configuration : [])
,aufs ? true
/*
Address/netmask to be always added, whatever
network-interfaces configure is kept
*/
,addIP ? ""
,netmask ? "255.255.255.0"
/* To select interface to bind address to */
,ifName ? "eth0"
/*
list of: {source, target}
*/
,additionalFiles ? []
}:
let
ttyCount = lib.fold builtins.add 0 [
@ -205,6 +219,21 @@ rec {
'';
}
)
++
(lib.optional (addIP != "")
{
name = "add-IP-adress";
job = ''
start on network-interfaces/started
script
${pkgs.nettools}/sbin/ifconfig ${ifName} add ${addIP} up
${pkgs.nettools}/sbin/ifconfig ${ifName}:0 netmask ${netmask} up
end script
'';
}
)
;
# And a background to go with that.
@ -395,6 +424,8 @@ rec {
target = "boot/memtest.bin";
}
)
++
additionalFiles
;
};