2009-06-11 10:51:27 +01:00
|
|
|
# This module contains the basic configuration for building a NixOS
|
|
|
|
# installation CD.
|
2009-06-05 16:10:15 +01:00
|
|
|
|
2009-11-10 21:42:38 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-06-05 16:10:15 +01:00
|
|
|
|
2009-06-08 23:45:45 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
# 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. !!! Once
|
|
|
|
# we use squashfs, maybe we won't need this anymore.
|
|
|
|
makeTarball = tarName: input: pkgs.runCommand "tarball" {inherit tarName;}
|
|
|
|
''
|
|
|
|
ensureDir $out
|
|
|
|
(cd ${input} && tar cvfj $out/${tarName} . \
|
|
|
|
--exclude '*~' --exclude 'result')
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Put the current directory in a tarball.
|
2009-11-10 21:42:38 +00:00
|
|
|
nixosTarball = makeTarball "nixos.tar.bz2" (cleanSource ../../..);
|
2009-06-08 23:45:45 +01:00
|
|
|
|
|
|
|
# Put Nixpkgs in a tarball.
|
2009-11-10 21:42:38 +00:00
|
|
|
nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" (cleanSource pkgs.path);
|
|
|
|
|
|
|
|
includeSources = true;
|
2009-06-10 13:34:58 +01:00
|
|
|
|
2009-06-08 23:45:45 +01:00
|
|
|
in
|
|
|
|
|
2009-06-05 16:10:15 +01:00
|
|
|
{
|
2009-06-09 14:14:43 +01:00
|
|
|
require =
|
2010-09-25 10:32:52 +01:00
|
|
|
[ ./memtest.nix
|
2010-01-03 17:13:30 +00:00
|
|
|
./iso-image.nix
|
2010-09-25 10:32:43 +01:00
|
|
|
|
|
|
|
# Profiles of this basic installation CD.
|
2010-09-25 10:32:27 +01:00
|
|
|
../../profiles/base.nix
|
2010-09-25 10:32:43 +01:00
|
|
|
../../profiles/installation-device.nix
|
2009-06-09 14:14:43 +01:00
|
|
|
];
|
2009-06-05 16:10:15 +01:00
|
|
|
|
2009-06-09 16:23:03 +01:00
|
|
|
# ISO naming.
|
2011-04-20 11:48:52 +01:00
|
|
|
isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixosVersion}-${pkgs.stdenv.system}.iso";
|
2009-06-09 16:23:03 +01:00
|
|
|
|
2009-06-22 17:38:11 +01:00
|
|
|
isoImage.volumeID = "NIXOS_INSTALL_CD_${config.system.nixosVersion}";
|
2009-06-09 16:23:03 +01:00
|
|
|
|
2009-06-05 18:19:30 +01:00
|
|
|
boot.postBootCommands =
|
|
|
|
''
|
|
|
|
export PATH=${pkgs.gnutar}/bin:${pkgs.bzip2}/bin:$PATH
|
|
|
|
|
2009-06-10 13:34:58 +01:00
|
|
|
# Provide the NixOS/Nixpkgs sources in /etc/nixos. This is required
|
|
|
|
# for nixos-install.
|
2009-11-10 21:42:38 +00:00
|
|
|
${optionalString includeSources ''
|
|
|
|
echo "unpacking the NixOS/Nixpkgs sources..."
|
|
|
|
mkdir -p /etc/nixos/nixos
|
|
|
|
tar xjf ${nixosTarball}/nixos.tar.bz2 -C /etc/nixos/nixos
|
|
|
|
mkdir -p /etc/nixos/nixpkgs
|
|
|
|
tar xjf ${nixpkgsTarball}/nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs
|
|
|
|
chown -R root.root /etc/nixos
|
|
|
|
''}
|
2011-03-16 15:17:54 +00:00
|
|
|
|
|
|
|
# Make the installer more likely to succeed in low memory
|
|
|
|
# environments. The kernel's overcommit heustistics bite us
|
|
|
|
# fairly often, preventing processes such as nix-worker or
|
|
|
|
# download-using-manifests.pl from forking even if there is
|
|
|
|
# plenty of free memory.
|
|
|
|
echo 1 > /proc/sys/vm/overcommit_memory
|
2009-06-05 18:19:30 +01:00
|
|
|
'';
|
2009-06-08 23:45:45 +01:00
|
|
|
|
2009-06-09 14:27:50 +01:00
|
|
|
# To speed up installation a little bit, include the complete stdenv
|
|
|
|
# in the Nix store on the CD.
|
2010-01-06 20:51:10 +00:00
|
|
|
isoImage.storeContents = [ pkgs.stdenv pkgs.klibc pkgs.klibcShrunk ];
|
2009-06-05 16:10:15 +01:00
|
|
|
}
|