From ca061eb628db7c0f824dfe9220acbe56fd8bda0e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 8 Jun 2009 22:45:45 +0000 Subject: [PATCH] * Include the NixOS/Nixpkgs trees on the CD. svn path=/nixos/branches/modular-nixos/; revision=15897 --- modules/installer/cd-dvd/installation-cd.nix | 30 ++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/installer/cd-dvd/installation-cd.nix b/modules/installer/cd-dvd/installation-cd.nix index e5181aebda69..e4496384b857 100644 --- a/modules/installer/cd-dvd/installation-cd.nix +++ b/modules/installer/cd-dvd/installation-cd.nix @@ -2,9 +2,33 @@ {config, pkgs, ...}: +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. + nixosTarball = makeTarball "nixos.tar.bz2" (pkgs.lib.cleanSource ../../..); + + # Put Nixpkgs in a tarball. + nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" (pkgs.lib.cleanSource pkgs.path); + +in + { require = [./iso-image.nix]; + # Use Linux 2.6.29. + boot.kernelPackages = pkgs.kernelPackages_2_6_29; + # Don't include X libraries. services.sshd.forwardX11 = false; fonts.enableFontConfig = false; @@ -92,9 +116,11 @@ echo "unpacking the NixOS/Nixpkgs sources..." mkdir -p /etc/nixos/nixos - tar xjf /install/nixos.tar.bz2 -C /etc/nixos/nixos + tar xjf ${nixosTarball}/nixos.tar.bz2 -C /etc/nixos/nixos mkdir -p /etc/nixos/nixpkgs - tar xjf /install/nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs + tar xjf ${nixpkgsTarball}/nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs chown -R root.root /etc/nixos ''; + + }