2007-03-19 21:28:09 +01:00
|
|
|
{ platform ? __currentSystem
|
|
|
|
}:
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
rec {
|
2006-11-12 19:48:47 +01:00
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
|
2008-01-03 14:34:16 +01:00
|
|
|
nixpkgsRel = "nixpkgs-0.12pre10056";
|
2007-01-09 22:19:06 +01:00
|
|
|
|
|
|
|
|
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 = {
|
|
|
|
autoDetectRootDevice = true;
|
|
|
|
readOnlyRoot = true;
|
|
|
|
# The label used to identify the installation CD.
|
|
|
|
rootLabel = "NIXOS";
|
|
|
|
};
|
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;
|
|
|
|
};
|
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.
|
|
|
|
{ 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
|
2007-02-05 17:52:13 +01:00
|
|
|
mkdir -p /etc/nixos/nixos
|
|
|
|
tar xjf /nixos.tar.bz2 -C /etc/nixos/nixos
|
|
|
|
tar xjf /nixpkgs.tar.bz2 -C /etc/nixos
|
|
|
|
mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs
|
|
|
|
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
|
2007-02-05 22:18:02 +01:00
|
|
|
chown -R root.root /etc/nixos
|
2007-02-05 17:52:13 +01:00
|
|
|
end script
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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 = "
|
|
|
|
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 = 8;
|
|
|
|
theme = pkgs.fetchurl {
|
|
|
|
url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2;
|
|
|
|
md5 = "61969309d23c631e57b0a311102ef034";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
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 = {
|
|
|
|
nixpkgsURL = http://nix.cs.uu.nl/dist/nix/ + nixpkgsRel;
|
|
|
|
};
|
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 = {
|
|
|
|
extraPackages = pkgs: [
|
2008-01-02 17:09:55 +01:00
|
|
|
pkgs.vim
|
2008-01-03 14:34:16 +01:00
|
|
|
pkgs.subversion # for nixos-checkout
|
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 {
|
2007-03-19 21:28:09 +01:00
|
|
|
inherit configuration platform;
|
2006-11-13 12:41:27 +01:00
|
|
|
stage2Init = "/init";
|
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;
|
|
|
|
|
2006-11-12 19:48:47 +01:00
|
|
|
|
|
|
|
# Since the CD is read-only, the mount points must be on disk.
|
2006-12-10 23:43:04 +01:00
|
|
|
cdMountPoints = pkgs.runCommand "mount-points" {} "
|
|
|
|
ensureDir $out
|
|
|
|
cd $out
|
2007-05-09 19:32:41 +02:00
|
|
|
mkdir proc sys tmp etc dev var mnt nix nix/var root bin
|
2006-12-16 19:24:49 +01:00
|
|
|
touch $out/${configuration.boot.rootLabel}
|
2006-12-10 23:43:04 +01:00
|
|
|
";
|
2006-11-12 19:48:47 +01:00
|
|
|
|
|
|
|
|
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} . \\
|
2006-12-16 19:24:49 +01:00
|
|
|
--exclude '*~' \\
|
2006-12-10 23:43:04 +01:00
|
|
|
--exclude 'pkgs' --exclude 'result')
|
|
|
|
";
|
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).
|
2007-01-15 10:20:34 +01:00
|
|
|
nixosTarball =
|
|
|
|
let filter = name: type:
|
|
|
|
let base = baseNameOf (toString name);
|
|
|
|
in base != ".svn" && base != "result";
|
|
|
|
in
|
|
|
|
makeTarball "nixos.tar.bz2" (builtins.filterSource filter ./..);
|
2006-12-16 19:24:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Get a recent copy of Nixpkgs.
|
2006-11-17 16:27:31 +01:00
|
|
|
nixpkgsTarball = pkgs.fetchurl {
|
2007-01-09 22:19:06 +01:00
|
|
|
url = configuration.installer.nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
|
2008-01-03 14:34:16 +01:00
|
|
|
md5 = "a25cd6eb5e753703823fdd3ae86e9f25";
|
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" ''
|
|
|
|
default=0
|
|
|
|
timeout=5
|
|
|
|
title NixOS Installer / Rescue
|
|
|
|
kernel /boot/vmlinuz ${toString system.config.boot.kernelParams}
|
|
|
|
initrd /boot/initrd
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
# 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 {
|
2007-01-23 15:38:15 +01:00
|
|
|
inherit (pkgs) stdenv perl cdrtools;
|
2007-03-19 21:28:09 +01:00
|
|
|
isoName = "nixos-${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-01-03 16:06:55 +01:00
|
|
|
{ source = "${pkgs.grub}/lib/grub/i386-pc/stage2_eltorito";
|
|
|
|
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
|
|
|
}
|
|
|
|
{ source = pkgs.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
|
|
|
}
|
|
|
|
{ source = cdMountPoints;
|
|
|
|
target = "/";
|
|
|
|
}
|
2006-11-17 16:27:31 +01:00
|
|
|
{ source = nixosTarball + "/" + nixosTarball.tarName;
|
|
|
|
target = "/" + nixosTarball.tarName;
|
|
|
|
}
|
|
|
|
{ source = nixpkgsTarball;
|
|
|
|
target = "/nixpkgs.tar.bz2";
|
|
|
|
}
|
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";
|
2006-11-12 19:48:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|