Fixed some bugs in rescue-cd-configurable, fixed live-dvd. Tested: QEmu + kQemu + no networking installs OK

svn path=/nixos/trunk/; revision=10104
This commit is contained in:
Michael Raskin 2008-01-09 14:33:41 +00:00
parent df0879e105
commit fb92b4666d
2 changed files with 81 additions and 311 deletions

View file

@ -1,310 +1,77 @@
{ platform ? __currentSystem {platform ? __currentSystem} :
}: let
isoFun = import ./rescue-cd-configurable.nix;
in
(isoFun {
inherit platform;
lib = (import ../pkgs/lib);
rec { networkNixpkgs = "";
manualEnabled = true;
rogueEnabled = true;
sshdEnabled = true;
fontConfigEnabled = true;
sudoEnable = true;
includeMemtest = true;
includeStdenv = true;
includeBuildDeps = true;
kernel = pkgs: (
pkgs.module_aggregation
[pkgs.kernel]
);
nixpkgsRel = "nixpkgs"; packages = pkgs : [
pkgs.irssi
pkgs.elinks
configuration = { pkgs.ltrace
pkgs.subversion
boot = { pkgs.which
autoDetectRootDevice = true; pkgs.file
readOnlyRoot = true; pkgs.zip
# The label used to identify the installation CD. pkgs.unzip
rootLabel = "NIXOS"; pkgs.unrar
extraTTYs = [7 8]; # manual, rogue pkgs.usbutils
}; pkgs.bc
pkgs.cpio
services = { pkgs.ncat
pkgs.patch
sshd = { pkgs.fuse
enable = false; pkgs.indent
}; pkgs.zsh
pkgs.hddtemp
xserver = { pkgs.hdparm
enable = false; pkgs.sdparm
}; pkgs.sqlite
pkgs.wpa_supplicant
extraJobs = [ pkgs.lynx
# Unpack the NixOS/Nixpkgs sources to /etc/nixos. pkgs.db4
{ name = "unpack-sources"; pkgs.rogue
job = " pkgs.attr
start on startup pkgs.acl
script pkgs.automake
export PATH=${pkgs.gnutar}/bin:${pkgs.bzip2}/bin:$PATH pkgs.autoconf
mkdir -p /etc/nixos/nixos pkgs.libtool
tar xjf /nixos.tar.bz2 -C /etc/nixos/nixos pkgs.gnupg
mkdir -p /etc/nixos/nixpkgs pkgs.openssl
tar xjf /nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs pkgs.units
mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs || test -e /etc/nixos/nixpkgs pkgs.gnumake
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs pkgs.manpages
chown -R root.root /etc/nixos pkgs.cabextract
touch /etc/resolv.conf pkgs.upstartJobControl
end script pkgs.fpc
"; pkgs.python
} pkgs.perl
pkgs.lftp
# Show the NixOS manual on tty7. pkgs.wget
{ name = "manual"; pkgs.guile
job = " pkgs.utillinuxCurses
start on udev pkgs.emacs
stop on shutdown pkgs.iproute
respawn ${pkgs.w3m}/bin/w3m ${manual} < /dev/tty7 > /dev/tty7 2>&1 pkgs.MPlayer
"; pkgs.diffutils
} pkgs.pciutils
pkgs.lsof
# Allow the user to do something useful on tty8 while waiting pkgs.vimHugeX
# for the installation to finish. ];
{ name = "rogue"; }).rescueCD
job = "
start on udev
stop on shutdown
respawn ${pkgs.rogue}/bin/rogue < /dev/tty8 > /dev/tty8 2>&1
";
}
];
# And a background to go with that.
ttyBackgrounds = {
specificThemes = [
{ tty = 7;
# Theme is GPL according to http://kde-look.org/content/show.php/Green?content=58501.
theme = pkgs.fetchurl {
url = http://www.kde-look.org/CONTENT/content-files/58501-green.tar.gz;
sha256 = "0sdykpziij1f3w4braq8r8nqg4lnsd7i7gi1k5d7c31m2q3b9a7r";
};
}
{ tty = 8;
theme = pkgs.fetchurl {
url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2;
md5 = "61969309d23c631e57b0a311102ef034";
};
}
];
};
mingetty = {
helpLine = ''
Log in as "root" with an empty password. Press <Alt-F7> for help.
'';
};
};
fonts = {
enableFontConfig = true;
};
installer = {
manifests = [ file:///mnt/MANIFEST ];
nixpkgsURL = file:///mnt/ ;
};
security = {
sudo = {
enable = true;
};
};
environment = {
extraPackages = pkgs: [
pkgs.irssi
pkgs.elinks
pkgs.ltrace
pkgs.subversion
pkgs.which
pkgs.file
pkgs.zip
pkgs.unzip
pkgs.unrar
pkgs.usbutils
pkgs.bc
pkgs.cpio
pkgs.ncat
pkgs.patch
pkgs.fuse
pkgs.indent
pkgs.zsh
pkgs.hddtemp
pkgs.hdparm
pkgs.sdparm
pkgs.sqlite
pkgs.wpa_supplicant
pkgs.lynx
pkgs.db4
pkgs.rogue
pkgs.attr
pkgs.acl
pkgs.automake
pkgs.autoconf
pkgs.libtool
pkgs.gnupg
pkgs.openssl
pkgs.units
pkgs.gnumake
pkgs.manpages
pkgs.cabextract
pkgs.upstartJobControl
pkgs.fpc
pkgs.python
pkgs.perl
pkgs.lftp
pkgs.wget
pkgs.guile
pkgs.utillinuxCurses
pkgs.emacs
pkgs.iproute
pkgs.MPlayer
pkgs.diffutils
pkgs.pciutils
pkgs.lsof
pkgs.vim
];
};
};
system = import ../system/system.nix {
inherit configuration platform;
stage2Init = "/init";
};
pkgs = system.pkgs;
# The NixOS manual, with a backward compatibility hack for Nix <=
# 0.11 (you won't get the manual).
manual =
if builtins ? unsafeDiscardStringContext
then "${import ../doc/manual}/manual.html"
else pkgs.writeText "dummy-manual" "Manual not included in this build!";
# Since the CD is read-only, the mount points must be on disk.
cdMountPoints = pkgs.runCommand "mount-points" {} "
ensureDir $out
cd $out
mkdir proc sys tmp etc dev var mnt nix nix/var root bin
touch $out/${configuration.boot.rootLabel}
";
# We need a copy of the Nix expressions for Nixpkgs and NixOS on the
# CD. We put them in a tarball because accessing that many small
# files from a slow device like a CD-ROM takes too long.
makeTarball = tarName: input: pkgs.runCommand "tarball" {inherit tarName;} "
ensureDir $out
(cd ${input} && tar cvfj $out/${tarName} . \\
--exclude '*~' \\
--exclude 'result')
";
makeTarballNixos = tarName: input: pkgs.runCommand "tarball" {inherit tarName;} "
ensureDir $out
(cd ${input} && tar cvfj $out/${tarName} . \\
--exclude '*~' \\
--exclude 'pkgs' --exclude 'result')
";
# Put the current directory in a tarball (making sure to filter
# out crap like the .svn directories).
nixosTarball =
let filter = name: type:
let base = baseNameOf (toString name);
in base != "result";
in
makeTarballNixos "nixos.tar.bz2" (builtins.filterSource filter ./..);
# Get a recent copy of Nixpkgs.
nixpkgsTarball = /* /root/nixpkgs.tar.bz2; */
let filter = name: type:
let base = baseNameOf (toString name);
in base != "result";
in
makeTarball "nixpkgs.tar.bz2" (builtins.filterSource filter /etc/nixos/nixpkgs);
# The configuration file for Grub.
grubCfg = pkgs.writeText "menu.lst" ''
default 0
timeout 10
splashimage /boot/background.xpm.gz
title NixOS Installer / Rescue
kernel /boot/vmlinuz ${toString system.config.boot.kernelParams}
initrd /boot/initrd
title Memtest86+
kernel /boot/memtest.bin
'';
# Create an ISO image containing the Grub boot loader, the kernel,
# the initrd produced above, and the closure of the stage 2 init.
rescueCD = import ../helpers/make-iso9660-image.nix {
inherit (pkgs) stdenv perl cdrkit;
isoName = "nixos-${platform}.iso";
# Single files to be copied to fixed locations on the CD.
contents = [
{ source = "${pkgs.grub}/lib/grub/i386-pc/stage2_eltorito";
target = "boot/grub/stage2_eltorito";
}
{ source = grubCfg;
target = "boot/grub/menu.lst";
}
{ source = pkgs.kernel + "/vmlinuz";
target = "boot/vmlinuz";
}
{ source = system.initialRamdisk + "/initrd";
target = "boot/initrd";
}
{ source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin";
}
{ source = system.config.boot.grubSplashImage;
target = "boot/background.xpm.gz";
}
{ source = cdMountPoints;
target = "/";
}
{ source = nixosTarball + "/" + nixosTarball.tarName;
target = "/" + nixosTarball.tarName;
}
{ source = nixpkgsTarball + "/" +nixpkgsTarball.tarName;
target = "/nixpkgs.tar.bz2";
}
];
# Closures to be copied to the Nix store on the CD.
storeContents = [
{ object = system.bootStage2;
symlink = "/init";
}
{ object = system.system;
symlink = "/system";
}
# To speed up the installation, provide the full stdenv.
{ object = pkgs.stdenv;
symlink = "none";
}
];
buildStoreContents = [
{
object = system.system.drvPath;
symlink = "none";
}
];
bootable = true;
bootImage = "boot/grub/stage2_eltorito";
};
}

View file

@ -18,10 +18,11 @@ let
sshdEnabled = arg "sshdEnabled" false; sshdEnabled = arg "sshdEnabled" false;
fontConfigEnabled = arg "fontConfigEnabled" false; fontConfigEnabled = arg "fontConfigEnabled" false;
sudoEnable = arg "sudoEnable" false; sudoEnable = arg "sudoEnable" false;
packages = arg "packages" []; packages = arg "packages" (pkgs : []);
includeMemtest = arg "includeMemtest" true; includeMemtest = arg "includeMemtest" true;
includeStdenv = arg "includeStdenv" true; includeStdenv = arg "includeStdenv" true;
includeBuildDeps = arg "includeBuildDeps" false; includeBuildDeps = arg "includeBuildDeps" false;
kernel = arg "kernel" (pkgs : pkgs.kernel);
in in
rec { rec {
@ -39,6 +40,7 @@ rec {
rootLabel = "NIXOS"; rootLabel = "NIXOS";
extraTTYs = [] ++ (lib.optional manualEnabled 7) ++ extraTTYs = [] ++ (lib.optional manualEnabled 7) ++
(lib.optional rogueEnabled 8); (lib.optional rogueEnabled 8);
inherit kernel;
}; };
services = { services = {
@ -64,6 +66,7 @@ rec {
mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs || true mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs || true
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
chown -R root.root /etc/nixos chown -R root.root /etc/nixos
touch /etc/resolv.conf
end script end script
"; ";
}] }]
@ -147,7 +150,7 @@ rec {
pkgs.vim pkgs.vim
pkgs.subversion # for nixos-checkout pkgs.subversion # for nixos-checkout
pkgs.w3m # needed for the manual anyway pkgs.w3m # needed for the manual anyway
] ++ packages; ] ++ (packages pkgs);
}; };
}; };
@ -216,7 +219,7 @@ rec {
# The configuration file for Grub. # The configuration file for Grub.
grubCfg = pkgs.writeText "menu.lst" '' grubCfg = pkgs.writeText "menu.lst" (''
default 0 default 0
timeout 10 timeout 10
splashimage /boot/background.xpm.gz splashimage /boot/background.xpm.gz
@ -230,7 +233,7 @@ rec {
title Memtest86+ title Memtest86+
kernel /boot/memtest.bin kernel /boot/memtest.bin
'' else ""); '' else ""));
# Create an ISO image containing the Grub boot loader, the kernel, # Create an ISO image containing the Grub boot loader, the kernel,