2007-03-19 20:28:09 +00:00
|
|
|
{ platform ? __currentSystem
|
|
|
|
}:
|
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
rec {
|
2006-11-12 18:48:47 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
|
2008-01-04 17:26:04 +00:00
|
|
|
nixpkgsRel = "nixpkgs-0.12pre10072";
|
2007-01-09 21:19:06 +00:00
|
|
|
|
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
configuration = {
|
2007-01-08 23:10:29 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
boot = {
|
|
|
|
autoDetectRootDevice = true;
|
2008-01-24 16:56:09 +00:00
|
|
|
isLiveCD = true;
|
2006-12-16 18:24:49 +00:00
|
|
|
# The label used to identify the installation CD.
|
|
|
|
rootLabel = "NIXOS";
|
2008-01-04 16:11:12 +00:00
|
|
|
extraTTYs = [7 8]; # manual, rogue
|
2008-01-29 18:53:15 +00:00
|
|
|
extraModulePackages = [pkgs.aufs];
|
2008-01-24 16:56:09 +00:00
|
|
|
initrd = {
|
|
|
|
extraKernelModules = [
|
2008-01-29 18:53:15 +00:00
|
|
|
"aufs" # needed for live-CD operation
|
2008-01-24 16:56:09 +00:00
|
|
|
];
|
|
|
|
};
|
2006-12-16 18:24:49 +00:00
|
|
|
};
|
2007-01-08 23:10:29 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
services = {
|
2007-01-08 23:10:29 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
sshd = {
|
|
|
|
enable = false;
|
2008-01-16 13:59:03 +00:00
|
|
|
forwardX11 = false;
|
2006-12-16 18:24:49 +00:00
|
|
|
};
|
2007-01-08 23:10:29 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
xserver = {
|
|
|
|
enable = false;
|
|
|
|
};
|
2007-01-08 23:10:29 +00:00
|
|
|
|
|
|
|
extraJobs = [
|
2007-02-05 16:52:13 +00:00
|
|
|
# Unpack the NixOS/Nixpkgs sources to /etc/nixos.
|
|
|
|
{ name = "unpack-sources";
|
|
|
|
job = "
|
|
|
|
start on startup
|
|
|
|
script
|
2007-02-05 21:06:59 +00:00
|
|
|
export PATH=${pkgs.gnutar}/bin:${pkgs.bzip2}/bin:$PATH
|
2007-02-05 16:52:13 +00: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 21:18:02 +00:00
|
|
|
chown -R root.root /etc/nixos
|
2007-02-05 16:52:13 +00:00
|
|
|
end script
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2008-01-04 16:11:12 +00:00
|
|
|
# Show the NixOS manual on tty7.
|
|
|
|
{ name = "manual";
|
|
|
|
job = "
|
2008-01-24 16:56:09 +00:00
|
|
|
env HOME=/root
|
2008-01-04 16:11:12 +00:00
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
2008-01-05 23:27:15 +00:00
|
|
|
respawn ${pkgs.w3m}/bin/w3m ${manual} < /dev/tty7 > /dev/tty7 2>&1
|
2008-01-04 16:11:12 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2007-02-05 16:52:13 +00:00
|
|
|
# Allow the user to do something useful on tty8 while waiting
|
|
|
|
# for the installation to finish.
|
2007-01-08 23:10:29 +00:00
|
|
|
{ name = "rogue";
|
|
|
|
job = "
|
2008-01-24 16:56:09 +00:00
|
|
|
env HOME=/root
|
2007-01-08 23:10:29 +00: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 16:11:12 +00: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-08 23:10:29 +00:00
|
|
|
{ tty = 8;
|
|
|
|
theme = pkgs.fetchurl {
|
|
|
|
url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2;
|
|
|
|
md5 = "61969309d23c631e57b0a311102ef034";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2008-01-04 17:05:48 +00:00
|
|
|
|
|
|
|
mingetty = {
|
|
|
|
helpLine = ''
|
|
|
|
|
|
|
|
Log in as "root" with an empty password. Press <Alt-F7> for help.
|
|
|
|
'';
|
|
|
|
};
|
2007-01-08 23:10:29 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
};
|
2007-01-09 21:19:06 +00:00
|
|
|
|
2007-01-22 16:42:29 +00:00
|
|
|
fonts = {
|
|
|
|
enableFontConfig = false;
|
|
|
|
};
|
|
|
|
|
2007-01-09 21:19:06 +00:00
|
|
|
installer = {
|
|
|
|
nixpkgsURL = http://nix.cs.uu.nl/dist/nix/ + nixpkgsRel;
|
|
|
|
};
|
2007-01-22 16:42:29 +00:00
|
|
|
|
2007-08-16 16:09:06 +01:00
|
|
|
security = {
|
|
|
|
sudo = {
|
|
|
|
enable = false;
|
|
|
|
};
|
|
|
|
};
|
2007-11-08 18:15:12 +00:00
|
|
|
|
|
|
|
environment = {
|
|
|
|
extraPackages = pkgs: [
|
2008-01-02 16:09:55 +00:00
|
|
|
pkgs.vim
|
2008-01-03 13:34:16 +00:00
|
|
|
pkgs.subversion # for nixos-checkout
|
2008-01-04 16:11:12 +00:00
|
|
|
pkgs.w3m # needed for the manual anyway
|
2008-01-24 16:56:09 +00:00
|
|
|
pkgs.gdb # for debugging Nix
|
2007-11-08 18:15:12 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
};
|
2006-11-12 18:48:47 +00:00
|
|
|
|
|
|
|
|
2007-01-04 10:31:36 +00:00
|
|
|
system = import ../system/system.nix {
|
2007-03-19 20:28:09 +00:00
|
|
|
inherit configuration platform;
|
2006-11-13 11:41:27 +00:00
|
|
|
stage2Init = "/init";
|
2006-11-12 18:48:47 +00:00
|
|
|
};
|
|
|
|
|
2006-11-12 23:30:03 +00:00
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
pkgs = system.pkgs;
|
2008-01-04 16:11:12 +00:00
|
|
|
|
2006-11-12 18:48:47 +00:00
|
|
|
|
2008-01-05 23:27:15 +00:00
|
|
|
# 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!";
|
|
|
|
|
|
|
|
|
2006-11-17 15:27:31 +00: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 18:24:49 +00:00
|
|
|
makeTarball = tarName: input: pkgs.runCommand "tarball" {inherit tarName;} "
|
2006-12-10 22:43:04 +00:00
|
|
|
ensureDir $out
|
|
|
|
(cd ${input} && tar cvfj $out/${tarName} . \\
|
2006-12-16 18:24:49 +00:00
|
|
|
--exclude '*~' \\
|
2006-12-10 22:43:04 +00:00
|
|
|
--exclude 'pkgs' --exclude 'result')
|
|
|
|
";
|
2006-11-17 15:27:31 +00:00
|
|
|
|
|
|
|
|
2006-12-16 18:24:49 +00:00
|
|
|
# Put the current directory in a tarball (making sure to filter
|
|
|
|
# out crap like the .svn directories).
|
2007-01-15 09:20:34 +00: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 18:24:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Get a recent copy of Nixpkgs.
|
2006-11-17 15:27:31 +00:00
|
|
|
nixpkgsTarball = pkgs.fetchurl {
|
2007-01-09 21:19:06 +00:00
|
|
|
url = configuration.installer.nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
|
2008-01-04 17:26:04 +00:00
|
|
|
md5 = "6a793b877e2a4fa79827515902e1dfd8";
|
2006-11-17 15:27:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-01-03 15:06:55 +00:00
|
|
|
# The configuration file for Grub.
|
|
|
|
grubCfg = pkgs.writeText "menu.lst" ''
|
2008-01-03 17:07:28 +00:00
|
|
|
default 0
|
|
|
|
timeout 10
|
|
|
|
splashimage /boot/background.xpm.gz
|
2008-01-03 15:24:34 +00:00
|
|
|
|
2008-01-03 15:06:55 +00:00
|
|
|
title NixOS Installer / Rescue
|
|
|
|
kernel /boot/vmlinuz ${toString system.config.boot.kernelParams}
|
|
|
|
initrd /boot/initrd
|
2008-01-03 15:24:34 +00:00
|
|
|
|
|
|
|
title Memtest86+
|
|
|
|
kernel /boot/memtest.bin
|
2008-01-03 15:06:55 +00: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 10:45:21 +00:00
|
|
|
rescueCD = import ../helpers/make-iso9660-image.nix {
|
2008-01-04 15:17:54 +00:00
|
|
|
inherit (pkgs) stdenv perl cdrkit;
|
2007-03-19 20:28:09 +00:00
|
|
|
isoName = "nixos-${platform}.iso";
|
2007-01-23 13:44:41 +00:00
|
|
|
|
|
|
|
# Single files to be copied to fixed locations on the CD.
|
2006-11-12 18:48:47 +00:00
|
|
|
contents = [
|
2008-01-03 15:06:55 +00:00
|
|
|
{ source = "${pkgs.grub}/lib/grub/i386-pc/stage2_eltorito";
|
|
|
|
target = "boot/grub/stage2_eltorito";
|
2006-11-12 18:48:47 +00:00
|
|
|
}
|
2008-01-03 15:06:55 +00:00
|
|
|
{ source = grubCfg;
|
|
|
|
target = "boot/grub/menu.lst";
|
2006-11-12 18:48:47 +00:00
|
|
|
}
|
|
|
|
{ source = pkgs.kernel + "/vmlinuz";
|
2008-01-03 15:06:55 +00:00
|
|
|
target = "boot/vmlinuz";
|
2006-11-12 18:48:47 +00:00
|
|
|
}
|
2006-12-16 18:24:49 +00:00
|
|
|
{ source = system.initialRamdisk + "/initrd";
|
2008-01-03 15:06:55 +00:00
|
|
|
target = "boot/initrd";
|
2006-11-12 18:48:47 +00:00
|
|
|
}
|
2008-01-03 15:24:34 +00:00
|
|
|
{ source = pkgs.memtest86 + "/memtest.bin";
|
|
|
|
target = "boot/memtest.bin";
|
|
|
|
}
|
2008-01-04 16:11:12 +00:00
|
|
|
{ source = system.config.boot.grubSplashImage;
|
2008-01-03 17:07:28 +00:00
|
|
|
target = "boot/background.xpm.gz";
|
|
|
|
}
|
2006-11-17 15:27:31 +00:00
|
|
|
{ source = nixosTarball + "/" + nixosTarball.tarName;
|
|
|
|
target = "/" + nixosTarball.tarName;
|
|
|
|
}
|
|
|
|
{ source = nixpkgsTarball;
|
|
|
|
target = "/nixpkgs.tar.bz2";
|
|
|
|
}
|
2008-01-24 16:56:09 +00:00
|
|
|
{ source = pkgs.writeText "label" "";
|
|
|
|
target = "/${configuration.boot.rootLabel}";
|
|
|
|
}
|
2006-11-12 18:48:47 +00:00
|
|
|
];
|
|
|
|
|
2007-01-23 13:44:41 +00:00
|
|
|
# Closures to be copied to the Nix store on the CD.
|
|
|
|
storeContents = [
|
|
|
|
{ object = system.bootStage2;
|
|
|
|
symlink = "/init";
|
|
|
|
}
|
2007-05-09 18:32:41 +01:00
|
|
|
{ object = system.system;
|
|
|
|
symlink = "/system";
|
|
|
|
}
|
2007-01-23 14:38:15 +00:00
|
|
|
# To speed up the installation, provide the full stdenv.
|
|
|
|
{ object = pkgs.stdenv;
|
|
|
|
symlink = "none";
|
|
|
|
}
|
2007-01-23 13:44:41 +00:00
|
|
|
];
|
2006-11-12 18:48:47 +00:00
|
|
|
|
|
|
|
bootable = true;
|
2008-01-03 15:06:55 +00:00
|
|
|
bootImage = "boot/grub/stage2_eltorito";
|
2006-11-12 18:48:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|