2007-12-30 10:38:04 +01:00
|
|
|
{ platform ? __currentSystem
|
|
|
|
}:
|
|
|
|
|
|
|
|
rec {
|
|
|
|
|
|
|
|
|
|
|
|
nixpkgsRel = "nixpkgs";
|
|
|
|
|
|
|
|
|
|
|
|
configuration = {
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
autoDetectRootDevice = true;
|
|
|
|
readOnlyRoot = true;
|
|
|
|
# The label used to identify the installation CD.
|
|
|
|
rootLabel = "NIXOS";
|
2008-01-06 19:45:13 +01:00
|
|
|
extraTTYs = [7 8]; # manual, rogue
|
2007-12-30 10:38:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
|
|
|
|
sshd = {
|
|
|
|
enable = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
xserver = {
|
|
|
|
enable = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraJobs = [
|
|
|
|
# Unpack the NixOS/Nixpkgs sources to /etc/nixos.
|
|
|
|
{ name = "unpack-sources";
|
|
|
|
job = "
|
|
|
|
start on startup
|
|
|
|
script
|
|
|
|
export PATH=${pkgs.gnutar}/bin:${pkgs.bzip2}/bin:$PATH
|
|
|
|
mkdir -p /etc/nixos/nixos
|
|
|
|
tar xjf /nixos.tar.bz2 -C /etc/nixos/nixos
|
2007-12-31 15:15:34 +01:00
|
|
|
mkdir -p /etc/nixos/nixpkgs
|
|
|
|
tar xjf /nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs
|
|
|
|
mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs || test -e /etc/nixos/nixpkgs
|
2007-12-30 10:38:04 +01:00
|
|
|
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
|
|
|
|
chown -R root.root /etc/nixos
|
2007-12-31 15:15:34 +01:00
|
|
|
touch /etc/resolv.conf
|
2007-12-30 10:38:04 +01:00
|
|
|
end script
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2008-01-06 19:45:13 +01:00
|
|
|
# Show the NixOS manual on tty7.
|
|
|
|
{ name = "manual";
|
|
|
|
job = "
|
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
|
|
|
respawn ${pkgs.w3m}/bin/w3m ${manual} < /dev/tty7 > /dev/tty7 2>&1
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2007-12-30 10:38:04 +01:00
|
|
|
# Allow the user to do something useful on tty8 while waiting
|
|
|
|
# for the installation to finish.
|
|
|
|
{ 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 = [
|
2008-01-06 19:45:13 +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-12-30 10:38:04 +01:00
|
|
|
{ tty = 8;
|
|
|
|
theme = pkgs.fetchurl {
|
|
|
|
url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2;
|
|
|
|
md5 = "61969309d23c631e57b0a311102ef034";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2008-01-06 19:45:13 +01:00
|
|
|
|
|
|
|
mingetty = {
|
|
|
|
helpLine = ''
|
|
|
|
|
|
|
|
Log in as "root" with an empty password. Press <Alt-F7> for help.
|
|
|
|
'';
|
|
|
|
};
|
2007-12-30 10:38:04 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
fonts = {
|
2007-12-31 15:15:34 +01:00
|
|
|
enableFontConfig = true;
|
2007-12-30 10:38:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
installer = {
|
2007-12-31 15:15:34 +01:00
|
|
|
manifests = [ file:///mnt/MANIFEST ];
|
|
|
|
nixpkgsURL = file:///mnt/ ;
|
2007-12-30 10:38:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
security = {
|
|
|
|
sudo = {
|
2007-12-31 16:53:42 +01:00
|
|
|
enable = true;
|
2007-12-30 10:38:04 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
extraPackages = pkgs: [
|
2007-12-31 15:15:34 +01:00
|
|
|
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
|
2008-01-01 16:47:35 +01:00
|
|
|
pkgs.iproute
|
|
|
|
pkgs.MPlayer
|
|
|
|
pkgs.diffutils
|
|
|
|
pkgs.pciutils
|
|
|
|
pkgs.lsof
|
2008-01-02 18:03:10 +01:00
|
|
|
pkgs.vim
|
2007-12-30 10:38:04 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
system = import ../system/system.nix {
|
|
|
|
inherit configuration platform;
|
|
|
|
stage2Init = "/init";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
pkgs = system.pkgs;
|
2008-01-06 19:45:13 +01: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!";
|
|
|
|
|
2007-12-30 10:38:04 +01:00
|
|
|
|
|
|
|
# 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;} "
|
2007-12-31 15:15:34 +01:00
|
|
|
ensureDir $out
|
|
|
|
(cd ${input} && tar cvfj $out/${tarName} . \\
|
|
|
|
--exclude '*~' \\
|
|
|
|
--exclude 'result')
|
|
|
|
";
|
|
|
|
makeTarballNixos = tarName: input: pkgs.runCommand "tarball" {inherit tarName;} "
|
2007-12-30 10:38:04 +01:00
|
|
|
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);
|
2007-12-31 15:15:34 +01:00
|
|
|
in base != "result";
|
2007-12-30 10:38:04 +01:00
|
|
|
in
|
2007-12-31 15:15:34 +01:00
|
|
|
makeTarballNixos "nixos.tar.bz2" (builtins.filterSource filter ./..);
|
2007-12-30 10:38:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Get a recent copy of Nixpkgs.
|
2007-12-31 15:15:34 +01:00
|
|
|
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);
|
|
|
|
|
2007-12-30 10:38:04 +01:00
|
|
|
|
2008-01-04 18:06:14 +01:00
|
|
|
# The configuration file for Grub.
|
|
|
|
grubCfg = pkgs.writeText "menu.lst" ''
|
|
|
|
default 0
|
|
|
|
timeout 10
|
|
|
|
splashimage /boot/background.xpm.gz
|
2007-12-30 10:38:04 +01:00
|
|
|
|
2008-01-04 18:06:14 +01:00
|
|
|
title NixOS Installer / Rescue
|
|
|
|
kernel /boot/vmlinuz ${toString system.config.boot.kernelParams}
|
|
|
|
initrd /boot/initrd
|
|
|
|
|
|
|
|
title Memtest86+
|
|
|
|
kernel /boot/memtest.bin
|
|
|
|
'';
|
2007-12-30 10:38:04 +01:00
|
|
|
|
|
|
|
|
2008-01-04 18:06:14 +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.
|
2007-12-30 10:38:04 +01:00
|
|
|
rescueCD = import ../helpers/make-iso9660-image.nix {
|
2008-01-06 19:45:13 +01:00
|
|
|
inherit (pkgs) stdenv perl cdrkit;
|
2007-12-30 10:38:04 +01:00
|
|
|
isoName = "nixos-${platform}.iso";
|
|
|
|
|
|
|
|
# Single files to be copied to fixed locations on the CD.
|
|
|
|
contents = [
|
2008-01-04 18:06:14 +01:00
|
|
|
{ source = "${pkgs.grub}/lib/grub/i386-pc/stage2_eltorito";
|
|
|
|
target = "boot/grub/stage2_eltorito";
|
2007-12-30 10:38:04 +01:00
|
|
|
}
|
2008-01-04 18:06:14 +01:00
|
|
|
{ source = grubCfg;
|
|
|
|
target = "boot/grub/menu.lst";
|
2007-12-30 10:38:04 +01:00
|
|
|
}
|
|
|
|
{ source = pkgs.kernel + "/vmlinuz";
|
2008-01-04 18:06:14 +01:00
|
|
|
target = "boot/vmlinuz";
|
2007-12-30 10:38:04 +01:00
|
|
|
}
|
|
|
|
{ source = system.initialRamdisk + "/initrd";
|
2008-01-04 18:06:14 +01:00
|
|
|
target = "boot/initrd";
|
|
|
|
}
|
|
|
|
{ source = pkgs.memtest86 + "/memtest.bin";
|
|
|
|
target = "boot/memtest.bin";
|
|
|
|
}
|
2008-01-06 19:45:13 +01:00
|
|
|
{ source = system.config.boot.grubSplashImage;
|
2008-01-04 18:06:14 +01:00
|
|
|
target = "boot/background.xpm.gz";
|
2007-12-30 10:38:04 +01:00
|
|
|
}
|
|
|
|
{ source = cdMountPoints;
|
|
|
|
target = "/";
|
|
|
|
}
|
|
|
|
{ source = nixosTarball + "/" + nixosTarball.tarName;
|
|
|
|
target = "/" + nixosTarball.tarName;
|
|
|
|
}
|
2007-12-31 15:15:34 +01:00
|
|
|
{ source = nixpkgsTarball + "/" +nixpkgsTarball.tarName;
|
2007-12-30 10:38:04 +01:00
|
|
|
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;
|
2008-01-04 18:06:14 +01:00
|
|
|
bootImage = "boot/grub/stage2_eltorito";
|
2007-12-30 10:38:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|