LiveDVD with X and sources made.

svn path=/nixos/trunk/; revision=10119
This commit is contained in:
Michael Raskin 2008-01-11 16:59:39 +00:00
parent a11779f912
commit 4475a74fb8
8 changed files with 388 additions and 55 deletions

View File

@ -80,7 +80,9 @@ needWritableDir /var 0755
needWritableDir /nix/var 0755
needWritableDir /root 0700
needWritableDir /bin 0755 # for the /bin/sh symlink
if test -d /home ; then
needWritableDir /home 0777
fi
# Miscellaneous boot time cleanup.
rm -rf /var/run

View File

@ -0,0 +1,122 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
xResolutions = [
{ x = 2048; y = 1536; }
{ x = 1920; y = 1024; }
{ x = 1280; y = 800; }
{ x = 1024; y = 768; }
{ x = 800; y = 600; }
{ x = 640; y = 480; }
];
xConfiguration = {
enable = true;
exportConfiguration = true;
tcpEnable = true;
resolutions = xResolutions;
sessionType = "xterm";
windowManager = "twm";
tty = "9";
};
theKernel = pkgs: let baseKernel=pkgs.kernel;
in (pkgs.module_aggregation
[
baseKernel
(pkgs.kqemuFunCurrent baseKernel)
(pkgs.atherosFun {
kernel = baseKernel;
version = "r2756";
pci001c_rev01 = true;
} null)
]);
in
(isoFun {
inherit platform;
lib = (import ../pkgs/lib);
networkNixpkgs = "";
manualEnabled = true;
rogueEnabled = true;
sshdEnabled = true;
fontConfigEnabled = true;
sudoEnable = true;
includeMemtest = true;
includeStdenv = true;
includeBuildDeps = true;
addUsers = ["nixos" "livecd" "livedvd"
"user" "guest" "nix"];
kernel = pkgs: (
pkgs.module_aggregation
[pkgs.kernel]
);
packages = pkgs : [
pkgs.which
pkgs.file
pkgs.zip
pkgs.unzip
pkgs.unrar
pkgs.db4
pkgs.attr
pkgs.acl
pkgs.manpages
pkgs.cabextract
pkgs.upstartJobControl
pkgs.utillinuxCurses
pkgs.emacs
pkgs.lsof
pkgs.vimHugeX
pkgs.firefoxWrapper
pkgs.xlaunch
pkgs.ratpoison
pkgs.xorg.twm
pkgs.xorg.xorgserver
pkgs.xorg.xhost
pkgs.xorg.xfontsel
pkgs.xlaunch
pkgs.xorg.xauth
pkgs.xorg.xset
pkgs.xterm
pkgs.xorg.xev
pkgs.xorg.xmodmap
pkgs.xorg.xkbcomp
pkgs.xorg.setxkbmap
];
configList = configuration : [
{
suffix = "X-vesa";
configuration = (configuration //
{
boot=configuration.boot // {configurationName = "X with vesa";};
services = configuration.services // {
xserver = xConfiguration // {videoDriver = "vesa";};
};
});
}
{
suffix = "X-Intel";
configuration = (configuration //
{
boot=configuration.boot // {configurationName = "X with Intel graphic card";};
services = configuration.services // {
xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;};
};
});
}
{
suffix = "X-ATI";
configuration = (configuration //
{
boot=configuration.boot // {configurationName = "X with ATI graphic card";};
services = configuration.services // {
xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;};
};
});
}
];
}).rescueCD

View File

@ -1,6 +1,37 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
xResolutions = [
{ x = 2048; y = 1536; }
{ x = 1920; y = 1024; }
{ x = 1280; y = 800; }
{ x = 1024; y = 768; }
{ x = 800; y = 600; }
{ x = 640; y = 480; }
];
xConfiguration = {
enable = true;
exportConfiguration = true;
tcpEnable = true;
resolutions = xResolutions;
sessionType = "xterm";
windowManager = "twm";
tty = "9";
};
theKernel = pkgs: let baseKernel=pkgs.kernel;
in (pkgs.module_aggregation
[
baseKernel
(pkgs.kqemuFunCurrent baseKernel)
(pkgs.atherosFun {
kernel = baseKernel;
version = "r2756";
pci001c_rev01 = true;
} null)
]);
in
(isoFun {
inherit platform;
@ -15,6 +46,8 @@ in
includeMemtest = true;
includeStdenv = true;
includeBuildDeps = true;
addUsers = ["nixos" "livecd" "livedvd"
"user" "guest" "nix"];
kernel = pkgs: (
pkgs.module_aggregation
@ -23,7 +56,6 @@ in
packages = pkgs : [
pkgs.irssi
pkgs.elinks
pkgs.ltrace
pkgs.subversion
pkgs.which
@ -73,5 +105,109 @@ in
pkgs.pciutils
pkgs.lsof
pkgs.vimHugeX
pkgs.xpdf
pkgs.ghostscript
pkgs.gv
pkgs.firefoxWrapper
pkgs.xlaunch
pkgs.wirelesstools
pkgs.usbutils
pkgs.dmidecode
pkgs.sdparm
pkgs.hdparm
pkgs.hddtemp
(theKernel pkgs)
pkgs.sshfsFuse
pkgs.ratpoison
pkgs.xorg.twm
pkgs.binutils
pkgs.xorg.lndir
pkgs.pstree
pkgs.psmisc
pkgs.aspell
pkgs.gettext
pkgs.xorg.xorgserver
pkgs.xorg.xsetroot
pkgs.xorg.xhost
pkgs.xorg.xwd
pkgs.xorg.xfontsel
pkgs.xorg.xwud
pkgs.xlaunch
pkgs.xsel
pkgs.xorg.xmessage
pkgs.xorg.xauth
pkgs.keynav
pkgs.xorg.xset
pkgs.xterm
pkgs.xmove
pkgs.xorg.xev
pkgs.xorg.xmodmap
pkgs.xorg.xkbcomp
pkgs.xorg.setxkbmap
/*
pkgs.elinks
pkgs.clisp
pkgs.djvulibre
pkgs.imagemagick
*/
/*
pkgs.pidgin
pkgs.pidginotr
pkgs.gdmap
pkgs.sox
pkgs.timidity
pkgs.xscreensaver
pkgs.thunderbird
pkgs.graphviz
pkgs.tetex
pkgs.pidginlatex
pkgs.openoffice
pkgs.wv
pkgs.maxima
pkgs.jre
pkgs.wine
pkgs.qemu
pkgs.qemuImage
pkgs.wireshark
pkgs.gimp
pkgs.audacity
pkgs.tightvnc
pkgs.bittornado
*/
];
configList = configuration : [
{
suffix = "X-vesa";
configuration = (configuration //
{
boot=configuration.boot // {configurationName = "X with vesa";};
services = configuration.services // {
xserver = xConfiguration // {videoDriver = "vesa";};
};
});
}
{
suffix = "X-Intel";
configuration = (configuration //
{
boot=configuration.boot // {configurationName = "X with Intel graphic card";};
services = configuration.services // {
xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;};
};
});
}
{
suffix = "X-ATI";
configuration = (configuration //
{
boot=configuration.boot // {configurationName = "X with ATI graphic card";};
services = configuration.services // {
xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;};
};
});
}
];
}).rescueCD

View File

@ -23,6 +23,72 @@ let
includeStdenv = arg "includeStdenv" true;
includeBuildDeps = arg "includeBuildDeps" false;
kernel = arg "kernel" (pkgs : pkgs.kernel);
addUsers = arg "addUsers" [];
/* Should return list of {configuration, suffix} attrsets.
{configuration=configuration; suffix=""} is always prepended.
*/
configList = arg "configList" (configuration : []);
in
let
systemPackBuilder = {suffix, configuration} : {
system = (import ../system/system.nix) {
inherit configuration platform; /* To refactor later - x86+x86_64 DVD */
stage2Init = "/init"+suffix;
};
inherit suffix configuration;
};
systemPackGrubEntry = systemPack : (''
title NixOS Installer / Rescue ${systemPack.system.config.boot.configurationName}
kernel /boot/vmlinuz${systemPack.suffix} ${toString systemPack.system.config.boot.kernelParams} systemConfig=/system${systemPack.suffix}
initrd /boot/initrd${systemPack.suffix}
'');
systemPackInstallRootList = systemPack : [
{ source = systemPack.system.kernel + "/vmlinuz";
target = "boot/vmlinuz${systemPack.suffix}";
}
{ source = systemPack.system.initialRamdisk + "/initrd";
target = "boot/initrd${systemPack.suffix}";
}
];
systemPackInstallClosures = systemPack : ([
{ object = systemPack.system.bootStage2;
symlink = "/init${systemPack.suffix}";
}
{ object = systemPack.system.system;
symlink = "/system${systemPack.suffix}";
}
]
++
(lib.optional includeStdenv
# To speed up the installation, provide the full stdenv.
{ object = systemPack.system.pkgs.stdenv;
symlink = "none";
}
)
);
systemPackInstallBuildClosure = systemPack : ([
{
object = systemPack.system.system.drvPath;
symlink = "none";
}
]);
userEntry = user : {
name = user;
description = "NixOS Live Disk non-root user";
home = "/home/${user}";
createHome = true;
group = "users";
extraGroups = ["wheel" "audio"];
shell = "/bin/sh";
};
in
rec {
@ -95,6 +161,22 @@ rec {
respawn ${pkgs.rogue}/bin/rogue < /dev/tty8 > /dev/tty8 2>&1
";
})
++
(lib.optional (addUsers != [])
# Set empty passwords
{
name = "clear-passwords";
job = ''
start on startup
script
for i in ${lib.concatStringsSep " " addUsers}; do
echo | ${pkgs.pwdutils}/bin/passwd --stdin $i
done
end script
'';
})
;
# And a background to go with that.
@ -124,7 +206,11 @@ rec {
helpLine = ''
Log in as "root" with an empty password.
''+(if manualEnabled then " Press <Alt-F7> for help." else "");
''
+(if addUsers != [] then '' These users also have empty passwords:
${lib.concatStringsSep " " addUsers }
'' else "")
+(if manualEnabled then " Press <Alt-F7> for help." else "");
};
};
@ -152,17 +238,21 @@ rec {
pkgs.w3m # needed for the manual anyway
] ++ (packages pkgs);
};
users = {
extraUsers = map userEntry addUsers;
};
};
configurations = [{
inherit configuration;
suffix = "";
}] ++ (configList configuration);
systemPacks = map systemPackBuilder configurations;
system = import ../system/system.nix {
inherit configuration platform;
stage2Init = "/init";
};
pkgs = system.pkgs;
system = (builtins.head systemPacks).system; /* I hope this is unneeded */
pkgs = system.pkgs; /* Nothing non-fixed should be built from it */
# The NixOS manual, with a backward compatibility hack for Nix <=
@ -177,7 +267,7 @@ rec {
cdMountPoints = pkgs.runCommand "mount-points" {} "
ensureDir $out
cd $out
mkdir proc sys tmp etc dev var mnt nix nix/var root bin
mkdir proc sys tmp etc dev var mnt nix nix/var root bin ${if addUsers != "" then "home" else ""}
touch $out/${configuration.boot.rootLabel}
";
@ -192,7 +282,7 @@ rec {
--exclude 'pkgs' --exclude 'result')
";
makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball" {inherit tarName;} "
makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball-nixpkgs" {inherit tarName;} "
ensureDir $out
(cd ${input}/.. && tar cvfj $out/${tarName} nixpkgs \\
--exclude '*~' \\
@ -223,11 +313,8 @@ rec {
default 0
timeout 10
splashimage /boot/background.xpm.gz
title NixOS Installer / Rescue
kernel /boot/vmlinuz ${toString system.config.boot.kernelParams}
initrd /boot/initrd
''
''+
(lib.concatStrings (map systemPackGrubEntry systemPacks))
+ (if includeMemtest then
''
@ -243,20 +330,18 @@ rec {
isoName = "nixos-${platform}.iso";
# Single files to be copied to fixed locations on the CD.
contents = [
contents = lib.uniqList {inputList =
[
{ source = "${pkgs.grub}/lib/grub/i386-pc/stage2_eltorito";
target = "boot/grub/stage2_eltorito";
}
{ source = grubCfg;
target = "boot/grub/menu.lst";
}
{ source = pkgs.kernel + "/vmlinuz";
target = "boot/vmlinuz";
}
{ source = system.initialRamdisk + "/initrd";
target = "boot/initrd";
}
{ source = system.config.boot.grubSplashImage;
}]
++
(lib.concatLists (map systemPackInstallRootList systemPacks))
++
[{ source = system.config.boot.grubSplashImage;
target = "boot/background.xpm.gz";
}
{ source = cdMountPoints;
@ -275,34 +360,22 @@ rec {
target = "boot/memtest.bin";
}
)
;
;};
# Closures to be copied to the Nix store on the CD.
storeContents = [
{ object = system.bootStage2;
symlink = "/init";
}
{ object = system.system;
symlink = "/system";
}
]
++
(lib.optional includeStdenv
# To speed up the installation, provide the full stdenv.
{ object = pkgs.stdenv;
symlink = "none";
}
)
;
storeContents = lib.uniqListExt {
inputList= lib.concatLists
(map systemPackInstallClosures systemPacks);
getter = x : x.object.drvPath;
compare = lib.eqStrings;
};
buildStoreContents = []
buildStoreContents = lib.uniqList {inputList=([]
++
(lib.optional includeBuildDeps
{
object = system.system.drvPath;
symlink = "none";
}
);
(if includeBuildDeps then lib.concatLists
(map systemPackInstallBuildClosure systemPacks)
else [])
);};
bootable = true;
bootImage = "boot/grub/stage2_eltorito";

View File

@ -6,7 +6,6 @@ targets_=($targets)
objects=($objects)
symlinks=($symlinks)
if test -n "$bootable"; then
# The -boot-info-table option modifies the $bootImage file, so
@ -55,7 +54,6 @@ for ((n = 0; n < ${#objects[*]}; n++)); do
fi
done
# !!! -f is a quick hack.
ensureDir $out/iso
genisoimage -r -J -o $out/iso/$isoName $bootFlags \

View File

@ -1685,6 +1685,7 @@ root ALL=(ALL) SETENV: ALL
createHome = true;
group = "users";
extraGroups = ["wheel"];
shell = "/bin/sh";
}
];
description = "

View File

@ -82,7 +82,7 @@ rec {
# Awful hackery necessary to pass the users/groups to the activation script.
createUsersGroups = ../helpers/create-users-groups.sh;
usersList = pkgs.writeText "users" (pkgs.lib.concatStrings (map (u: "${u.name}\n${u.description}\n${toString u.uid}\n${u.group}\n${toString u.extraGroups}\n${u.home}\n${u.shell}\n${toString u.createHome}\n") users));
usersList = pkgs.writeText "users" (pkgs.lib.concatStrings (map (u: "${u.name}\n${u.description}\n${toString u.uid}\n${u.group}\n${toString (pkgs.lib.concatStringsSep "," u.extraGroups)}\n${u.home}\n${u.shell}\n${toString u.createHome}\n") users));
groupsList = pkgs.writeText "groups" (pkgs.lib.concatStrings (map (g: "${g.name}\n${toString g.gid}\n") groups));
}

View File

@ -13,7 +13,8 @@ let
adminEmail = cfg.adminEmail;
extraIPs = cfg.extraIPs;
extraPort = cfg.extraPort;
gw6cEnabled = config.services.gw6c.enable;
gw6cEnabled = (config.services.gw6c.enable) &&
(config.services.gw6c.autorun);
};
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";