2007-03-19 21:28:09 +01:00
|
|
|
{ platform ? __currentSystem
|
2008-02-08 16:59:15 +01:00
|
|
|
, relName ?
|
|
|
|
if builtins.pathExists ../relname
|
|
|
|
then builtins.readFile ../relname
|
|
|
|
else "nixos-${builtins.readFile ../VERSION}"
|
2008-06-05 15:42:18 +02:00
|
|
|
, compressImage ? false
|
2008-06-05 17:33:17 +02:00
|
|
|
, nixpkgsPath ? ../../nixpkgs
|
2007-03-19 21:28:09 +01:00
|
|
|
}:
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
rec {
|
2006-11-12 19:48:47 +01:00
|
|
|
|
2008-08-09 01:01:30 +02:00
|
|
|
|
|
|
|
cdLabel = "NIXOS_INSTALLATION_CD";
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
|
|
|
|
configuration = {
|
2007-01-09 00:10:29 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
boot = {
|
2008-01-24 17:56:09 +01:00
|
|
|
isLiveCD = true;
|
2008-01-04 17:11:12 +01:00
|
|
|
extraTTYs = [7 8]; # manual, rogue
|
2008-08-08 21:40:19 +02:00
|
|
|
extraModulePackages = [system.kernelPackages.aufs];
|
2008-05-22 13:59:46 +02:00
|
|
|
|
2008-08-08 21:40:19 +02:00
|
|
|
kernelPackages = pkgs.kernelPackages_2_6_25;
|
2008-02-08 16:59:15 +01:00
|
|
|
|
2008-01-24 17:56:09 +01:00
|
|
|
initrd = {
|
|
|
|
extraKernelModules = [
|
2008-02-08 16:59:15 +01:00
|
|
|
# The initrd should contain any modules necessary for
|
|
|
|
# mounting the CD.
|
|
|
|
|
|
|
|
# SATA/PATA support.
|
|
|
|
"ahci"
|
|
|
|
|
|
|
|
"ata_piix"
|
|
|
|
|
|
|
|
"sata_inic162x" "sata_nv" "sata_promise" "sata_qstor"
|
|
|
|
"sata_sil" "sata_sil24" "sata_sis" "sata_svw" "sata_sx4"
|
|
|
|
"sata_uli" "sata_via" "sata_vsc"
|
|
|
|
|
|
|
|
"pata_ali" "pata_amd" "pata_artop" "pata_atiixp"
|
2008-02-09 00:51:43 +01:00
|
|
|
"pata_cs5520" "pata_cs5530" /* "pata_cs5535" */ "pata_efar"
|
2008-02-08 16:59:15 +01:00
|
|
|
"pata_hpt366" "pata_hpt37x" "pata_hpt3x2n" "pata_hpt3x3"
|
|
|
|
"pata_it8213" "pata_it821x" "pata_jmicron" "pata_marvell"
|
|
|
|
"pata_mpiix" "pata_netcell" "pata_ns87410" "pata_oldpiix"
|
2008-02-09 00:51:43 +01:00
|
|
|
"pata_pcmcia" "pata_pdc2027x" /* "pata_qdi" */ "pata_rz1000"
|
2008-02-08 16:59:15 +01:00
|
|
|
"pata_sc1200" "pata_serverworks" "pata_sil680" "pata_sis"
|
|
|
|
"pata_sl82c105" "pata_triflex" "pata_via"
|
|
|
|
# "pata_winbond" <-- causes timeouts in sd_mod
|
|
|
|
|
|
|
|
# SCSI support (incomplete).
|
|
|
|
"3w-9xxx" "3w-xxxx" "aic79xx" "aic7xxx" "arcmsr"
|
|
|
|
|
|
|
|
# USB support, especially for booting from USB CD-ROM
|
|
|
|
# drives. Also include USB keyboard support for when
|
|
|
|
# something goes wrong in stage 1.
|
|
|
|
"ehci_hcd"
|
|
|
|
"ohci_hcd"
|
|
|
|
"usbhid"
|
|
|
|
"usb_storage"
|
|
|
|
|
|
|
|
# Firewire support. Not tested.
|
|
|
|
"ohci1394" "sbp2"
|
|
|
|
|
|
|
|
# Wait for SCSI devices to appear.
|
|
|
|
"scsi_wait_scan"
|
|
|
|
|
|
|
|
# Needed for live-CD operation.
|
|
|
|
"aufs"
|
2008-01-24 17:56:09 +01:00
|
|
|
];
|
|
|
|
};
|
2006-12-16 19:24:49 +01:00
|
|
|
};
|
2008-02-04 11:52:58 +01:00
|
|
|
|
2008-08-09 01:01:30 +02:00
|
|
|
fileSystems = [
|
|
|
|
{ mountPoint = "/";
|
|
|
|
label = cdLabel;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2008-02-04 11:52:58 +01:00
|
|
|
networking = {
|
|
|
|
enableIntel3945ABGFirmware = true;
|
|
|
|
};
|
2007-01-09 00:10:29 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
services = {
|
2007-01-09 00:10:29 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
sshd = {
|
|
|
|
enable = false;
|
2008-01-16 14:59:03 +01:00
|
|
|
forwardX11 = false;
|
2006-12-16 19:24:49 +01:00
|
|
|
};
|
2007-01-09 00:10:29 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
xserver = {
|
|
|
|
enable = false;
|
|
|
|
};
|
2007-01-09 00:10:29 +01:00
|
|
|
|
|
|
|
extraJobs = [
|
2007-02-05 17:52:13 +01:00
|
|
|
# Unpack the NixOS/Nixpkgs sources to /etc/nixos.
|
2008-01-30 02:28:56 +01:00
|
|
|
# !!! run this synchronously
|
2007-02-05 17:52:13 +01:00
|
|
|
{ name = "unpack-sources";
|
|
|
|
job = "
|
|
|
|
start on startup
|
|
|
|
script
|
2007-02-05 22:06:59 +01:00
|
|
|
export PATH=${pkgs.gnutar}/bin:${pkgs.bzip2}/bin:$PATH
|
2008-01-30 02:28:56 +01:00
|
|
|
|
2008-02-08 16:59:15 +01:00
|
|
|
mkdir -p /mnt
|
|
|
|
|
2008-01-30 02:28:56 +01:00
|
|
|
${system.nix}/bin/nix-store --load-db < /nix-path-registration
|
|
|
|
|
2007-02-05 17:52:13 +01:00
|
|
|
mkdir -p /etc/nixos/nixos
|
2008-01-30 02:28:56 +01:00
|
|
|
tar xjf /install/nixos.tar.bz2 -C /etc/nixos/nixos
|
2008-06-16 21:06:59 +02:00
|
|
|
mkdir -p /etc/nixos/nixpkgs
|
2008-06-05 17:33:17 +02:00
|
|
|
tar xjf /install/nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs
|
2007-02-05 22:18:02 +01:00
|
|
|
chown -R root.root /etc/nixos
|
2007-02-05 17:52:13 +01:00
|
|
|
end script
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2008-01-04 17:11:12 +01:00
|
|
|
# Show the NixOS manual on tty7.
|
|
|
|
{ name = "manual";
|
|
|
|
job = "
|
2008-01-24 17:56:09 +01:00
|
|
|
env HOME=/root
|
2008-01-04 17:11:12 +01:00
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
2008-01-06 00:27:15 +01:00
|
|
|
respawn ${pkgs.w3m}/bin/w3m ${manual} < /dev/tty7 > /dev/tty7 2>&1
|
2008-01-04 17:11:12 +01:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2007-02-05 17:52:13 +01:00
|
|
|
# Allow the user to do something useful on tty8 while waiting
|
|
|
|
# for the installation to finish.
|
2007-01-09 00:10:29 +01:00
|
|
|
{ name = "rogue";
|
|
|
|
job = "
|
2008-01-24 17:56:09 +01:00
|
|
|
env HOME=/root
|
2008-01-30 02:28:56 +01:00
|
|
|
chdir /root
|
2007-01-09 00:10:29 +01:00
|
|
|
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 = [
|
2008-01-04 17:11:12 +01:00
|
|
|
{ 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";
|
|
|
|
};
|
|
|
|
}
|
2007-01-09 00:10:29 +01:00
|
|
|
{ tty = 8;
|
|
|
|
theme = pkgs.fetchurl {
|
|
|
|
url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2;
|
|
|
|
md5 = "61969309d23c631e57b0a311102ef034";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2008-01-04 18:05:48 +01:00
|
|
|
|
|
|
|
mingetty = {
|
|
|
|
helpLine = ''
|
|
|
|
|
|
|
|
Log in as "root" with an empty password. Press <Alt-F7> for help.
|
|
|
|
'';
|
|
|
|
};
|
2007-01-09 00:10:29 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
};
|
2007-01-09 22:19:06 +01:00
|
|
|
|
2007-01-22 17:42:29 +01:00
|
|
|
fonts = {
|
|
|
|
enableFontConfig = false;
|
|
|
|
};
|
|
|
|
|
2007-01-09 22:19:06 +01:00
|
|
|
installer = {
|
2008-06-05 17:33:17 +02:00
|
|
|
nixpkgsURL = http://nixos.org/releases/nixpkgs/unstable;
|
2007-01-09 22:19:06 +01:00
|
|
|
};
|
2007-01-22 17:42:29 +01:00
|
|
|
|
2007-08-16 17:09:06 +02:00
|
|
|
security = {
|
|
|
|
sudo = {
|
|
|
|
enable = false;
|
|
|
|
};
|
|
|
|
};
|
2007-11-08 19:15:12 +01:00
|
|
|
|
|
|
|
environment = {
|
2008-08-08 21:40:19 +02:00
|
|
|
extraPackages = [
|
2008-01-02 17:09:55 +01:00
|
|
|
pkgs.vim
|
2008-01-03 14:34:16 +01:00
|
|
|
pkgs.subversion # for nixos-checkout
|
2008-01-04 17:11:12 +01:00
|
|
|
pkgs.w3m # needed for the manual anyway
|
2008-01-24 17:56:09 +01:00
|
|
|
pkgs.gdb # for debugging Nix
|
2008-02-08 16:59:15 +01:00
|
|
|
pkgs.testdisk # useful for repairing boot problems
|
|
|
|
pkgs.mssys # for writing Microsoft boot sectors / MBRs
|
2007-11-08 19:15:12 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
};
|
2006-11-12 19:48:47 +01:00
|
|
|
|
|
|
|
|
2007-01-04 11:31:36 +01:00
|
|
|
system = import ../system/system.nix {
|
2008-06-05 17:33:17 +02:00
|
|
|
inherit configuration platform nixpkgsPath;
|
2006-11-12 19:48:47 +01:00
|
|
|
};
|
|
|
|
|
2006-11-13 00:30:03 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
pkgs = system.pkgs;
|
2008-01-04 17:11:12 +01:00
|
|
|
|
2006-11-12 19:48:47 +01:00
|
|
|
|
2008-01-06 00:27:15 +01:00
|
|
|
# The NixOS manual, with a backward compatibility hack for Nix <=
|
|
|
|
# 0.11 (you won't get the manual).
|
|
|
|
manual =
|
|
|
|
if builtins ? unsafeDiscardStringContext
|
2008-06-05 17:33:17 +02:00
|
|
|
then "${import ../doc/manual {inherit nixpkgsPath;}}/manual.html"
|
2008-01-06 00:27:15 +01:00
|
|
|
else pkgs.writeText "dummy-manual" "Manual not included in this build!";
|
|
|
|
|
|
|
|
|
2006-11-17 16:27:31 +01:00
|
|
|
# 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.
|
2006-12-16 19:24:49 +01:00
|
|
|
makeTarball = tarName: input: pkgs.runCommand "tarball" {inherit tarName;} "
|
2006-12-10 23:43:04 +01:00
|
|
|
ensureDir $out
|
|
|
|
(cd ${input} && tar cvfj $out/${tarName} . \\
|
2008-06-27 14:28:43 +02:00
|
|
|
--exclude '*~' --exclude 'result')
|
2006-12-10 23:43:04 +01:00
|
|
|
";
|
2006-11-17 16:27:31 +01:00
|
|
|
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
# Put the current directory in a tarball (making sure to filter
|
|
|
|
# out crap like the .svn directories).
|
2008-06-27 14:28:43 +02:00
|
|
|
nixosTarball = makeTarball "nixos.tar.bz2" (builtins.filterSource svnFilter ./..);
|
2008-06-05 17:33:17 +02:00
|
|
|
|
|
|
|
svnFilter = name: type:
|
|
|
|
let base = baseNameOf (toString name);
|
|
|
|
in base != ".svn" && base != "result";
|
|
|
|
|
|
|
|
|
|
|
|
# Put Nixpkgs in a tarball
|
|
|
|
nixpkgsTarball = makeTarball "nixpkgs.tar.bz2"
|
|
|
|
(builtins.filterSource svnFilter nixpkgsPath);
|
2006-11-17 16:27:31 +01:00
|
|
|
|
|
|
|
|
2008-01-03 16:06:55 +01:00
|
|
|
# The configuration file for Grub.
|
|
|
|
grubCfg = pkgs.writeText "menu.lst" ''
|
2008-01-03 18:07:28 +01:00
|
|
|
default 0
|
|
|
|
timeout 10
|
|
|
|
splashimage /boot/background.xpm.gz
|
2008-03-19 13:58:14 +01:00
|
|
|
|
|
|
|
title Boot from hard disk
|
|
|
|
root (hd0)
|
|
|
|
chainloader +1
|
2008-01-03 16:24:34 +01:00
|
|
|
|
2008-01-03 16:06:55 +01:00
|
|
|
title NixOS Installer / Rescue
|
2008-08-08 17:49:57 +02:00
|
|
|
kernel /boot/vmlinuz init=/init ${toString system.config.boot.kernelParams}
|
2008-01-03 16:06:55 +01:00
|
|
|
initrd /boot/initrd
|
2008-01-03 16:24:34 +01:00
|
|
|
|
|
|
|
title Memtest86+
|
|
|
|
kernel /boot/memtest.bin
|
2008-01-03 16:06:55 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
# Create an ISO image containing the Grub boot loader, the kernel,
|
|
|
|
# the initrd produced above, and the closure of the stage 2 init.
|
2006-11-28 11:45:21 +01:00
|
|
|
rescueCD = import ../helpers/make-iso9660-image.nix {
|
2008-06-05 17:33:17 +02:00
|
|
|
inherit nixpkgsPath;
|
2008-01-04 16:17:54 +01:00
|
|
|
inherit (pkgs) stdenv perl cdrkit;
|
2008-02-08 16:59:15 +01:00
|
|
|
isoName = "${relName}-${platform}.iso";
|
2007-01-23 14:44:41 +01:00
|
|
|
|
|
|
|
# Single files to be copied to fixed locations on the CD.
|
2006-11-12 19:48:47 +01:00
|
|
|
contents = [
|
2008-08-15 16:28:52 +02:00
|
|
|
{ source = "${pkgs.grub}/lib/grub/${if platform == "i686-linux" then "i386-pc" else "x86_64-unknown"}/stage2_eltorito";
|
2008-01-03 16:06:55 +01:00
|
|
|
target = "boot/grub/stage2_eltorito";
|
2006-11-12 19:48:47 +01:00
|
|
|
}
|
2008-01-03 16:06:55 +01:00
|
|
|
{ source = grubCfg;
|
|
|
|
target = "boot/grub/menu.lst";
|
2006-11-12 19:48:47 +01:00
|
|
|
}
|
2008-05-22 13:59:46 +02:00
|
|
|
{ source = system.kernel + "/vmlinuz";
|
2008-01-03 16:06:55 +01:00
|
|
|
target = "boot/vmlinuz";
|
2006-11-12 19:48:47 +01:00
|
|
|
}
|
2006-12-16 19:24:49 +01:00
|
|
|
{ source = system.initialRamdisk + "/initrd";
|
2008-01-03 16:06:55 +01:00
|
|
|
target = "boot/initrd";
|
2006-11-12 19:48:47 +01:00
|
|
|
}
|
2008-01-03 16:24:34 +01:00
|
|
|
{ source = pkgs.memtest86 + "/memtest.bin";
|
|
|
|
target = "boot/memtest.bin";
|
|
|
|
}
|
2008-01-04 17:11:12 +01:00
|
|
|
{ source = system.config.boot.grubSplashImage;
|
2008-01-03 18:07:28 +01:00
|
|
|
target = "boot/background.xpm.gz";
|
|
|
|
}
|
2006-11-17 16:27:31 +01:00
|
|
|
{ source = nixosTarball + "/" + nixosTarball.tarName;
|
2008-01-30 02:28:56 +01:00
|
|
|
target = "/install/" + nixosTarball.tarName;
|
2006-11-17 16:27:31 +01:00
|
|
|
}
|
2008-06-05 17:33:17 +02:00
|
|
|
{ source = nixpkgsTarball + "/nixpkgs.tar.bz2";
|
2008-01-30 02:28:56 +01:00
|
|
|
target = "/install/nixpkgs.tar.bz2";
|
2006-11-17 16:27:31 +01:00
|
|
|
}
|
2006-11-12 19:48:47 +01:00
|
|
|
];
|
|
|
|
|
2007-01-23 14:44:41 +01:00
|
|
|
# Closures to be copied to the Nix store on the CD.
|
|
|
|
storeContents = [
|
|
|
|
{ object = system.bootStage2;
|
|
|
|
symlink = "/init";
|
|
|
|
}
|
2007-05-09 19:32:41 +02:00
|
|
|
{ object = system.system;
|
|
|
|
symlink = "/system";
|
|
|
|
}
|
2007-01-23 15:38:15 +01:00
|
|
|
# To speed up the installation, provide the full stdenv.
|
|
|
|
{ object = pkgs.stdenv;
|
|
|
|
symlink = "none";
|
|
|
|
}
|
2007-01-23 14:44:41 +01:00
|
|
|
];
|
2006-11-12 19:48:47 +01:00
|
|
|
|
|
|
|
bootable = true;
|
2008-01-03 16:06:55 +01:00
|
|
|
bootImage = "boot/grub/stage2_eltorito";
|
2008-06-05 15:42:18 +02:00
|
|
|
|
|
|
|
inherit compressImage;
|
2008-08-08 19:07:04 +02:00
|
|
|
|
2008-08-09 01:01:30 +02:00
|
|
|
volumeID = cdLabel;
|
2006-11-12 19:48:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|