3
0
Fork 0
forked from mirrors/nixpkgs

* Get the CD to build again.

svn path=/nixos/trunk/; revision=7356
This commit is contained in:
Eelco Dolstra 2006-12-16 18:24:49 +00:00
parent 57663aae6b
commit 8f21b0119c
7 changed files with 81 additions and 49 deletions

View file

@ -189,4 +189,13 @@
}
{
name = ["services" "xserver" "enable"];
default = false;
description = "
Whether to enable the X server.
";
}
]

View file

@ -108,7 +108,7 @@ rec {
# The services (Upstart) configuration for the system.
upstartJobs = import ./upstart.nix {
inherit pkgs nix splashThemes;
inherit config pkgs nix splashThemes;
};

View file

@ -1,4 +1,4 @@
{pkgs, nix, splashThemes}:
{config, pkgs, nix, splashThemes}:
let
@ -6,6 +6,9 @@ let
inherit (pkgs) runCommand;
};
optional = option: service:
if config.get option then [service] else [];
in
import ../upstart-jobs/gather.nix {
@ -39,22 +42,11 @@ import ../upstart-jobs/gather.nix {
dhcp = pkgs.dhcpWrapper;
})
# SSH daemon.
(import ../upstart-jobs/sshd.nix {
inherit (pkgs) openssh;
})
# Nix daemon - required for multi-user Nix.
(import ../upstart-jobs/nix-daemon.nix {
inherit nix;
})
# X server.
(import ../upstart-jobs/xserver.nix {
inherit (pkgs) substituteAll;
inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa;
})
# Transparent TTY backgrounds.
(import ../upstart-jobs/tty-backgrounds.nix {
inherit (pkgs) stdenv splashutils;
@ -71,6 +63,19 @@ import ../upstart-jobs/gather.nix {
]
# SSH daemon.
++ optional ["services" "sshd" "enable"]
(import ../upstart-jobs/sshd.nix {
inherit (pkgs) openssh;
})
# X server.
++ optional ["services" "xserver" "enable"]
(import ../upstart-jobs/xserver.nix {
inherit (pkgs) substituteAll;
inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa;
})
# Handles the reboot/halt events.
++ (map
(event: makeJob (import ../upstart-jobs/halt.nix {

View file

@ -1,10 +1,14 @@
{stdenv, runCommand, substituteAll, nix}:
{ stdenv, runCommand, substituteAll, nix
, # URL of the Nixpkgs distribution that the installer will pull.
# Leave empty for a pure source distribution.
nixpkgsURL ? ""
}:
substituteAll {
src = ./nixos-installer.sh;
dir = "bin";
isExecutable = true;
inherit nix;
inherit nix nixpkgsURL;
pathsFromGraph = ../helpers/paths-from-graph.sh;

View file

@ -106,8 +106,9 @@ cp /etc/resolv.conf $mountPoint/etc/
# Do a nix-pull to speed up building.
nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984
chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST
if test -n "@nixpkgsURL@"; then
chroot $mountPoint @nix@/bin/nix-pull @nixpkgsURL@/MANIFEST
fi
# Build the specified Nix expression in the target store and install

View file

@ -1,53 +1,66 @@
let
# The label used to identify the installation CD.
cdromLabel = "NIXOS";
in
# Build boot scripts for the CD that find the CD-ROM automatically.
with import ../configuration/boot-environment.nix {
autoDetectRootDevice = true;
rootLabel = cdromLabel;
stage2Init = "/init";
readOnlyRoot = true;
};
rec {
inherit nixosInstaller bootStage1 upstartJobs; # !!! debug
configuration = {
boot = {
autoDetectRootDevice = true;
readOnlyRoot = true;
# The label used to identify the installation CD.
rootLabel = "NIXOS";
};
services = {
sshd = {
enable = false;
};
xserver = {
enable = false;
};
};
};
system = import ../configuration/system.nix {
inherit configuration;
stage2Init = "/init";
};
pkgs = system.pkgs;
# 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
touch $out/${cdromLabel}
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" "
makeTarball = tarName: input: pkgs.runCommand "tarball" {inherit tarName;} "
ensureDir $out
(cd ${input} && tar cvfj $out/${tarName} . \\
--exclude '*~' --exclude '.svn' \\
--exclude '*~' \\
--exclude 'pkgs' --exclude 'result')
";
# Put the current directory in the tarball. !!! This gives us a lot
# of crap (like .svn if this is a working copy). An "svn export"
# would be better, but that's impure.
nixosTarball = makeTarball "nixos.tar.bz2" ./.;
# Put the current directory in a tarball (making sure to filter
# out crap like the .svn directories).
nixosTarball = makeTarball "nixos.tar.bz2" (builtins.filterSource
(name: let base = baseNameOf (toString name); in base != ".svn" && base != "result") ./..);
# Get a recent copy of Nixpkgs.
nixpkgsRel = "nixpkgs-0.11pre7355";
nixpkgsURL = http://nix.cs.uu.nl/dist/nix/ + nixpkgsRel;
nixpkgsTarball = pkgs.fetchurl {
url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7087/nixpkgs-0.11pre7087.tar.bz2;
md5 = "c5840fcd049d75e00ad856ecbbef6857";
url = nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
md5 = "9d3e5e9f6ab64536803abf3f2e1c6056";
};
@ -68,7 +81,7 @@ rec {
{ source = pkgs.kernel + "/vmlinuz";
target = "isolinux/vmlinuz";
}
{ source = initialRamdisk + "/initrd";
{ source = system.initialRamdisk + "/initrd";
target = "isolinux/initrd";
}
{ source = cdMountPoints;
@ -82,7 +95,7 @@ rec {
}
];
init = bootStage2;
init = system.bootStage2;
bootable = true;
bootImage = "isolinux/isolinux.bin";

View file

@ -24,14 +24,14 @@ for ((n = 0; n < ${#ttys[*]}; n++)); do
echo "TTY $tty -> $theme"
themeName=$(cd $theme && ls | grep -v default)
ln -sf $theme/$themeName $out/$themeName
ln -sfn $theme/$themeName $out/$themeName
if test -e $out/$tty; then
echo "Multiple themes defined for the same TTY!"
exit 1
fi
ln -sf $themeName $out/$tty
ln -sfn $themeName $out/$tty
done