I officially abandon old RescueCD rewrite. I made official version tunable by a small patch..

svn path=/nixos/trunk/; revision=15704
This commit is contained in:
Michael Raskin 2009-05-24 20:28:09 +00:00
parent dafb4b8c5d
commit 575631b72a
11 changed files with 94 additions and 1290 deletions

View File

@ -1,74 +0,0 @@
{
platform ? __currentSystem
,hostConnectPort ? "3737"
,sshPubKey ? /var/certs/ssh/id_livedvd.pub
} :
let
isoFun = import ./rescue-cd-configurable.nix;
in
(isoFun {
inherit platform;
networkNixpkgs = "";
manualEnabled = true;
rogueEnabled = false;
sshdEnabled = true;
fontConfigEnabled = false;
sudoEnable = true;
includeMemtest = false;
includeStdenv = true;
includeBuildDeps = true;
/*
If anyone uses that DVD on live
computer, use DHCP; but also add
a rogue address for tests in virtual
networks without DHCP at all.
*/
addIP = "10.0.253.251";
netmask = "255.255.0.0";
packages = pkgs : [
pkgs.patch
pkgs.irssi
pkgs.subversion
pkgs.w3m
pkgs.utillinuxCurses
pkgs.wpa_supplicant
pkgs.emacs
pkgs.vimHugeX
pkgs.socat
];
/*
The goal is remotely controlled
installation (maybe over virtual
networking with QEmu without human
interaction), so let's make ssh
work without manual password entry
*/
additionalFiles = [
{
source = sshPubKey;
target = "/root/.ssh/authorized_keys";
}
];
additionalJobs = [
{
name = "Socat-ssh-proxy";
job = ''
start on sshd/started
script
sleep 5
/var/run/current-system/sw/bin/socat tcp:10.0.2.2:${hostConnectPort} tcp:127.0.0.1:22
end script
'';
}
];
nix = pkgs: pkgs.nixCustomFun (pkgs.nixUnstable.src)
""
["nix-reduce-build" "nix-http-export.cgi"]
["--with-docbook-xsl=\\\${pkgs.docbook5_xsl}/xml/xsl/docbook/"];
extraInitrdKernelModules = ["usb_storage" "ehci_hcd" "ohci_hcd" "iso9660" "ext3"];
}).rescueCD

View File

@ -1,213 +0,0 @@
{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";
};
in
(isoFun (rec {
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"];
extraInitrdKernelModules =
import ./moduleList.nix;
arbitraryOverrides = config : config // {
services = config.services // {
gw6c = {
enable = true;
autorun = false;
};
};
};
packages = pkgs : [
pkgs.irssi
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.gnumake
pkgs.manpages
pkgs.cabextract
pkgs.upstartJobControl
pkgs.fpc
pkgs.perl
pkgs.lftp
pkgs.wget
pkgs.utillinuxCurses
pkgs.iproute
pkgs.diffutils
pkgs.pciutils
pkgs.lsof
pkgs.vimHugeX
pkgs.xpdf
pkgs.ghostscript
pkgs.gv
pkgs.firefoxWrapper
pkgs.xlaunch
pkgs.wirelesstools
pkgs.usbutils
pkgs.dmidecode
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.mssys
pkgs.testdisk
pkgs.gdb
pkgs.pidgin
pkgs.pidginotr
pkgs.gdmap
pkgs.thunderbird
pkgs.wv
pkgs.tightvnc
pkgs.bittornado
pkgs.wireshark
pkgs.smbfsFuse
pkgs.xfsProgs
pkgs.jfsUtils
pkgs.x11vnc
pkgs.lzma
pkgs.dict
pkgs.apacheHttpd
pkgs.xneur
(with pkgs.aspellDicts; [en fr ru])
(pkgs.dictDBCollector {
dictlist = with pkgs.dictdDBs; map
(x:{
name = x.dbName;
filename = x.outPath;
locale = x.locale;
})
[
eng2fra fra2eng eng2nld
nld2eng eng2rus
mueller_enru_abbr
mueller_enru_base
mueller_enru_dict
mueller_enru_geo
mueller_enru_names
];
})
];
configList = configuration : [
{
suffix = "X-vesa";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with vesa";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "vesa";};
};
});
}
{
suffix = "X-Intel";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with Intel graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;};
};
});
}
{
suffix = "X-ATI";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with ATI graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;};
};
});
}
{
suffix = "X-NVIDIA";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with NVIDIA graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "nvidia"; driSupport = true;};
};
});
}
];
})).rescueCD

View File

@ -1,121 +0,0 @@
{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";
};
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"];
extraModulePackages = pkgs: [pkgs.kernelPackages.kqemu];
extraInitrdKernelModules =
import ./moduleList.nix;
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
pkgs.mssys
pkgs.testdisk
pkgs.gdb
];
configList = configuration : [
{
suffix = "X-vesa";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with vesa";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "vesa";};
};
});
}
{
suffix = "X-Intel";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with Intel graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;};
};
});
}
{
suffix = "X-ATI";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with ATI graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;};
};
});
}
{
suffix = "X-NVIDIA";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with NVIDIA graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "nvidia"; driSupport = true;};
};
});
}
];
}).rescueCD

View File

@ -1,224 +0,0 @@
{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";
};
in
(isoFun (rec {
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"];
extraModulePackages = pkgs: [pkgs.kernelPackages.kqemu];
extraInitrdKernelModules =
import ./moduleList.nix;
arbitraryOverrides = config : config // {
services = config.services // {
gw6c = {
enable = true;
autorun = false;
};
};
};
packages = pkgs : [
pkgs.irssi
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
pkgs.iproute
pkgs.MPlayer
pkgs.diffutils
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
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.mssys
pkgs.testdisk
pkgs.gdb
pkgs.xfsProgs
pkgs.jfsUtils
pkgs.ddrescue
/*
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 = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with vesa";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "vesa";};
};
});
}
{
suffix = "X-Intel";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with Intel graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;};
};
});
}
{
suffix = "X-ATI";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with ATI graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;};
};
});
}
{
suffix = "X-NVIDIA";
configuration = args: ((configuration args) //
{
boot=(configuration args).boot // {configurationName = "X with NVIDIA graphic card";};
services = (configuration args).services // {
xserver = xConfiguration // {videoDriver = "nvidia"; driSupport = true;};
};
});
}
];
})).rescueCD

View File

@ -1,72 +0,0 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
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;
packages = pkgs : [
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
pkgs.iproute
pkgs.MPlayer
pkgs.diffutils
pkgs.pciutils
pkgs.lsof
pkgs.vimHugeX
];
}).rescueCD

View File

@ -1,18 +0,0 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
in
(isoFun {
inherit platform;
lib = (import ../pkgs/lib);
networkNixpkgs = "";
manualEnabled = false;
rogueEnabled = false;
sshdEnabled = false;
fontConfigEnabled = false;
sudoEnable = false;
includeMemtest = false;
includeStdenv = false;
includeBuildDeps = true;
}).rescueCD

View File

@ -1,482 +0,0 @@
{
lib ? null
,platform ? __currentSystem
,networkNixpkgs ? ""
,nixpkgsMd5 ? ""
,manualEnabled ? true
,rogueEnabled ? true
,sshdEnabled ? false
,fontConfigEnabled ? false
,sudoEnable ? false
,packages ? (pkgs : [])
,includeMemtest ? true
,includeStdenv ? true
,includeBuildDeps ? false
,kernelPackages ? (pkgs : pkgs.kernelPackages)
,extraModulePackages ? (pkgs : [])
,addUsers ? []
,extraInitrdKernelModules ? []
,bootKernelModules ? []
,arbitraryOverrides ? (config:{})
,cleanStart ? false
/* Should return list of {configuration, suffix} attrsets.
{configuration=configuration; suffix=""} is always prepended.
*/
,configList ? (configuration : [])
,aufs ? true
/*
Address/netmask to be always added, whatever
network-interfaces configure is kept
*/
,addIP ? ""
,netmask ? "255.255.255.0"
/* To select interface to bind address to */
,ifName ? "eth0"
/*
list of: {source, target}
*/
,additionalFiles ? []
,compressImage ? false
,nixpkgsPath ? ../../../nixpkgs
,additionalJobs ? []
,intel3945FWEnable ? true
,intel4965FWEnable ? true
,cdLabel ? "NIXOS_INSTALLATION_CD"
,relName ?
if builtins.pathExists ../../relname
then builtins.readFile ../../relname
else "nixos-${builtins.readFile ../../VERSION}"
,nix ? pkgs: pkgs.nix
}:
let
realLib = if lib != null then lib else (import (nixpkgsPath+"/pkgs/lib"));
in
let
lib = realLib;
ttyCount = lib.fold builtins.add 0 [
(if rogueEnabled then 1 else 0)
(if manualEnabled then 1 else 0)
];
systemPackBuilder = {suffix, configuration} :
{
system = (import ../../system/system.nix) {
inherit configuration platform nixpkgsPath; /* To refactor later - x86+x86_64 DVD */
};
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 {
inherit cdLabel;
nixpkgsRel = "nixpkgs" + (if networkNixpkgs != "" then "-" + networkNixpkgs else "");
configuration = {pkgs, config, ...}: let preConfiguration ={
boot = {
isLiveCD = true;
# The label used to identify the installation CD.
extraTTYs = []
++ (lib.optional manualEnabled 7)
++ (lib.optional rogueEnabled 8);
kernelPackages = kernelPackages pkgs;
initrd = {
extraKernelModules = extraInitrdKernelModules
++ (if aufs then ["aufs"] else [])
;
};
kernelModules = bootKernelModules;
extraModulePackages = ((extraModulePackages pkgs)
++(if aufs then [(kernelPackages pkgs).aufs] else [])
);
};
services = {
sshd = { enable = sshdEnabled; };
xserver = { enable = false; };
udev = {
addFirmware = []
#++ (pkgs.lib.optional intel3945FWEnable pkgs.iwlwifi3945ucode)
#++ (pkgs.lib.optional intel4965FWEnable pkgs.iwlwifi4965ucode)
;
};
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 /mnt
${system.nix}/bin/nix-store --load-db < /nix-path-registration
mkdir -p /etc/nixos/nixos
tar xjf /install/nixos.tar.bz2 -C /etc/nixos/nixos
tar xjf /install/nixpkgs.tar.bz2 -C /etc/nixos
tar xjf /install/nixos-services.tar.bz2 -C /etc/nixos
mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs || true
mv /etc/nixos/*-nixpkgs /etc/nixos/nixpkgs || true
mv /etc/nixos/*-services /etc/nixos/services || true
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
ln -sfn ../services /etc/nixos/services
chown -R root.root /etc/nixos
touch /etc/resolv.conf
end script
'';
}
]
++ additionalJobs
++
(lib.optional manualEnabled
# 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
'';
}
)
++
(lib.optional rogueEnabled
# 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
'';
}
)
++
(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
'';
}
)
++
(lib.optional (addIP != "")
{
name = "add-IP-adress";
job = ''
start on network-interfaces/started
script
${pkgs.nettools}/sbin/ifconfig ${ifName} add ${addIP} up
${pkgs.nettools}/sbin/ifconfig ${ifName}:0 netmask ${netmask} up
end script
'';
}
)
;
# And a background to go with that.
ttyBackgrounds = {
specificThemes = []
++
(lib.optional manualEnabled
{
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";
};
}
)
++
(lib.optional rogueEnabled
{
tty = 8;
theme = pkgs.fetchurl {
url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2;
md5 = "61969309d23c631e57b0a311102ef034";
};
}
)
;
};
mingetty = {
helpLine = ''
Log in as "root" with an empty password.
''
+(if addUsers != [] then
'' These users also have empty passwords:
${lib.concatStringsSep " " addUsers }
''
else "")
+(if manualEnabled then " Press <Alt-F7> for help." else "");
};
};
fonts = { enableFontConfig = fontConfigEnabled; };
installer = {
nixpkgsURL =
(if networkNixpkgs != "" then http://nix.cs.uu.nl/dist/nix/ + nixpkgsRel
else file:///mnt/ );
};
security = {
sudo = { enable = sudoEnable; };
};
environment = {
extraPackages = if cleanStart then [] else [
pkgs.vim
pkgs.subversion # for nixos-checkout
pkgs.w3m # needed for the manual anyway
] ++ (packages pkgs);
checkConfigurationOptions = true;
cleanStart = cleanStart;
nix = nix pkgs;
};
users = {
extraUsers = map userEntry addUsers;
};
fileSystems = [
{ mountPoint = "/";
label = cdLabel;
}
];
}; in preConfiguration // (arbitraryOverrides preConfiguration);
configurations = [{
inherit configuration;
suffix = "";
}] ++ (configList configuration);
systemPacks = map systemPackBuilder configurations;
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 <=
# 0.11 (you won't get the manual).
manual = if builtins ? unsafeDiscardStringContext
then "${import ../../doc/manual {inherit nixpkgsPath;}}/manual.html"
else pkgs.writeText "dummy-manual" "Manual not included in this build!";
# 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;} ''
ensureDir $out
(cd ${input} && tar cvfj $out/${tarName} . \
--exclude '*~' \
--exclude 'pkgs' --exclude 'result')
'';
makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball-nixpkgs" {inherit tarName;} ''
ensureDir $out
(cd ${input}/.. && tar cvfj $out/${tarName} $(basename ${input}) \
--exclude '*~' \
--exclude 'result')
'')+"/${tarName}");
# 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);
in base != ".svn" && base != "result";
in
makeTarball "nixos.tar.bz2" (builtins.filterSource filter ./../..);
# Get a recent copy of Nixpkgs.
nixpkgsTarball = if networkNixpkgs != "" then pkgs.fetchurl {
url = configuration.installer.nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
md5 = "6a793b877e2a4fa79827515902e1dfd8";
} else makeNixPkgsTarball "nixpkgs.tar.bz2" ("" + nixpkgsPath);
nixosServicesTarball = makeNixPkgsTarball "nixos-services.tar.bz2" ("" + ./../../../services);
# The configuration file for Grub.
grubCfg = pkgs.writeText "menu.lst" (''
default 0
timeout 10
splashimage /boot/background.xpm.gz
''+
(lib.concatStrings (map systemPackGrubEntry systemPacks))
+ (if includeMemtest then
''
title Memtest86+
kernel /boot/memtest.bin
'' else ""));
# Create an ISO image containing the Grub boot loader, the kernel,
# the initrd produced above, and the closure of the stage 2 init.
rescueCD = import ../../helpers/make-iso9660-image.nix {
inherit (pkgs) stdenv perl cdrkit;
inherit compressImage nixpkgsPath;
isoName = "nixos-${relName}-${platform}.iso";
# Single files to be copied to fixed locations on the CD.
contents = lib.uniqList {
inputList = [
{
source =
"${pkgs.grub}/lib/grub/${if platform == "i686-linux" then "i386-pc" else "x86_64-unknown"}/stage2_eltorito";
target = "boot/grub/stage2_eltorito";
}
{
source = grubCfg;
target = "boot/grub/menu.lst";
}
]
++
(lib.concatLists (map systemPackInstallRootList systemPacks))
++
[
{
source = system.config.boot.grubSplashImage;
target = "boot/background.xpm.gz";
}
{
source = nixosTarball + "/" + nixosTarball.tarName;
target = "/install/" + nixosTarball.tarName;
}
{
source = nixpkgsTarball;
target = "/install/nixpkgs.tar.bz2";
}
{
source = nixosServicesTarball;
target = "/install/nixos-services.tar.bz2";
}
]
++
(lib.optional includeMemtest
{
source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin";
}
)
++
additionalFiles
;
};
# Closures to be copied to the Nix store on the CD.
storeContents =
lib.uniqListExt {
inputList = lib.concatLists
(map systemPackInstallClosures systemPacks);
getter = x: x.object.drvPath;
compare = lib.eqStrings;
}
++ lib.uniqList {
inputList = lib.optionals includeBuildDeps
(lib.concatLists (map systemPackInstallBuildClosure systemPacks));
};
bootable = true;
bootImage = "boot/grub/stage2_eltorito";
volumeID = cdLabel;
};
}

View File

@ -1,18 +0,0 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
in
(isoFun {
inherit platform;
lib = (import ../pkgs/lib);
networkNixpkgs = "";
manualEnabled = false;
rogueEnabled = false;
sshdEnabled = false;
fontConfigEnabled = false;
sudoEnable = false;
includeMemtest = false;
includeStdenv = false;
includeBuildDeps = false;
}).rescueCD

View File

@ -1,36 +0,0 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
in
(isoFun {
inherit platform;
lib = (import ../pkgs/lib);
networkNixpkgs = "";
manualEnabled = false;
rogueEnabled = false;
sshdEnabled = false;
fontConfigEnabled = false;
sudoEnable = false;
includeMemtest = false;
includeStdenv = false;
includeBuildDeps = true;
cleanStart = true;
packages = pkgs: with pkgs; [
bashInteractive
bzip2
coreutils
curl
e2fsprogs
gnutar
grub
gzip
less
module_init_tools
nano
su
udev
upstart
utillinux
];
}).rescueCD

View File

@ -1,32 +0,0 @@
{platform ? __currentSystem} :
let
isoFun = import ./rescue-cd-configurable.nix;
in (isoFun {
inherit platform;
lib = (import ../pkgs/lib);
networkNixpkgs = "";
manualEnabled = false;
rogueEnabled = false;
sshdEnabled = false;
fontConfigEnabled = false;
sudoEnable = false;
includeMemtest = false;
includeStdenv = false;
includeBuildDeps = false;
extraInitrdKernelModules =
import ./moduleList.nix;
packages = pkgs: [
pkgs.vim
pkgs.subversion # for nixos-checkout
pkgs.w3m # needed for the manual anyway
pkgs.gdb # for debugging Nix
pkgs.testdisk # useful for repairing boot problems
pkgs.mssys # for writing Microsoft boot sectors / MBRs
pkgs.xfsProgs
pkgs.jfsUtils
pkgs.ddrescue
];
}).rescueCD

View File

@ -0,0 +1,94 @@
let
rescueCDFun = import /etc/nixos/nixos/installer/cd-dvd/rescue-cd.nix;
pkgs = import /etc/nixos/nixpkgs {};
kernels = import /etc/nixos/configurations/misc/raskin/kernel-options.nix {inherit pkgs;};
bootEntries = baseKernel: rec {
kernelPackages = let
shippedKernelPackages = pkgs.kernelPackagesFor (baseKernel);
in
shippedKernelPackages //
rec {
klibc = shippedKernelPackages.klibc.passthru.function (x: {
# version = "1.5.14";
# sha256 = "1cmrqpgamnv2ns7dlxjm61zc88dxm4ff0aya413ij1lmhp2h2sfc";
# subdir = "Testing/";
addPreBuild = ''
ln -s $PWD/linux/include/*/errno.h linux/include/asm || echo errno.h already present
'';
});
klibcShrunk = shippedKernelPackages.klibcShrunk.passthru.function {
inherit klibc;
};
};
};
in
rescueCDFun {
includeBuildDeps = true;
configurationOverrides = x: {
boot = x.boot // {
kernelPackages = (bootEntries kernels.testingKernel).kernelPackages;
initrd = x.boot.initrd // {
extraKernelModules = x.boot.initrd.extraKernelModules ++ [
"sr_mod" "atiixp"
];
allowMissing = true;
};
};
environment = {
extraPackages = x.environment.extraPackages ++ [
pkgs.utillinuxCurses pkgs.wpa_supplicant
pkgs.upstartJobControl pkgs.iproute
pkgs.bc pkgs.fuse pkgs.zsh
pkgs.sqlite pkgs.gnupg pkgs.manpages
pkgs.pinentry pkgs.screen
pkgs.patch pkgs.which pkgs.diffutils pkgs.file
pkgs.irssi pkgs.mcabber pkgs.mutt
pkgs.emacs pkgs.vimHugeX pkgs.bvi
pkgs.ddrescue pkgs.cdrkit
pkgs.btrfsProgs pkgs.xfsProgs pkgs.jfsUtils
pkgs.jfsrec pkgs.ntfs3g
pkgs.subversion16 pkgs.monotone pkgs.git pkgs.darcs
pkgs.mercurial pkgs.bazaar pkgs.cvs
pkgs.pciutils pkgs.hddtemp pkgs.sdparm pkgs.hdparm
pkgs.usbutils
pkgs.openssh pkgs.lftp pkgs.w3m pkgs.openssl pkgs.ncat
pkgs.lynx pkgs.wget pkgs.elinks pkgs.socat pkgs.squid
pkgs.unrar pkgs.zip pkgs.unzip pkgs.lzma pkgs.cabextract
pkgs.cpio
pkgs.lsof pkgs.ltrace
pkgs.perl pkgs.python pkgs.ruby pkgs.guile pkgs.clisp
pkgs.tcl
];
nix = pkgs.nixCustomFun ("" + /etc/nixos/nix + "/")
""
["nix-reduce-build" "nix-http-export.cgi"]
["--with-docbook-xsl=${pkgs.docbook5_xsl}/xml/xsl/docbook/"];
};
# nesting = {
# children = [
# (x // {
# boot = x.boot // {
# kernelPackages = (bootEntries kernels.testingKernel).kernelPackages;
# configurationName = "Test child configuration";
# };
# })
# ];
# };
};
}