* Clean up diskImages/diskImageFuns/diskImageExtraFuns.

svn path=/nixpkgs/trunk/; revision=22265
This commit is contained in:
Eelco Dolstra 2010-06-14 18:42:18 +00:00
parent 5be3acda2d
commit 98dff00f52

View File

@ -4,7 +4,6 @@ with pkgs;
rec { rec {
inherit (linuxPackages_2_6_32) kernel; inherit (linuxPackages_2_6_32) kernel;
kvm = pkgs.qemu_kvm; kvm = pkgs.qemu_kvm;
@ -12,7 +11,9 @@ rec {
modulesClosure = makeModulesClosure { modulesClosure = makeModulesClosure {
inherit kernel; inherit kernel;
rootModules = [ "cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" "nls_utf8" "ext2" "ext3" "unix" "sd_mod" "ata_piix" ]; rootModules =
[ "cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon"
"nls_utf8" "ext2" "ext3" "unix" "sd_mod" "ata_piix" ];
}; };
@ -336,7 +337,7 @@ rec {
''; '';
/* Run a command in a x86 virtual machine image containing an /* Run a command in an x86 virtual machine image containing an
arbitrary OS. The VM should be configured to do the following: arbitrary OS. The VM should be configured to do the following:
- Write log output to the serial port. - Write log output to the serial port.
@ -351,8 +352,7 @@ rec {
- Write an exit code to "in-vm-exit" on the SMB share ("0" - Write an exit code to "in-vm-exit" on the SMB share ("0"
meaning success). meaning success).
- Reboot to shutdown the machine (because Qemu doesn't seem - Power-off or reboot the machine.
capable of a APM/ACPI VM shutdown).
*/ */
runInGenericVM = drv: lib.overrideDerivation drv (attrs: { runInGenericVM = drv: lib.overrideDerivation drv (attrs: {
system = "i686-linux"; system = "i686-linux";
@ -652,13 +652,16 @@ rec {
names. */ names. */
makeImageFromRPMDist = makeImageFromRPMDist =
{ name, fullName, size ? 4096, urlPrefix, packagesList, packages { name, fullName, size ? 4096, urlPrefix, packagesList
, preInstall ? "", postInstall ? "", archs ? ["noarch" "i386"], runScripts ? true}: , packages, extraPackages ? []
, preInstall ? "", postInstall ? "", archs ? ["noarch" "i386"]
, runScripts ? true }:
fillDiskWithRPMs { fillDiskWithRPMs {
inherit name fullName size preInstall postInstall runScripts; inherit name fullName size preInstall postInstall runScripts;
rpms = import (rpmClosureGenerator { rpms = import (rpmClosureGenerator {
inherit name packagesList urlPrefix packages archs; inherit name packagesList urlPrefix archs;
packages = packages ++ extraPackages;
}) {inherit fetchurl;}; }) {inherit fetchurl;};
}; };
@ -685,11 +688,13 @@ rec {
names. */ names. */
makeImageFromDebDist = makeImageFromDebDist =
{name, fullName, size ? 4096, urlPrefix, packagesList, packages, postInstall ? ""}: { name, fullName, size ? 4096, urlPrefix, packagesList
, packages, extraPackages ? [], postInstall ? "" }:
let let
expr = debClosureGenerator { expr = debClosureGenerator {
inherit name packagesList urlPrefix packages; inherit name packagesList urlPrefix;
packages = packages ++ extraPackages;
}; };
in in
(fillDiskWithDebs { (fillDiskWithDebs {
@ -698,13 +703,11 @@ rec {
}) // {inherit expr;}; }) // {inherit expr;};
/* A bunch of functions that build disk images of various Linux /* The set of supported RPM-based distributions. */
distributions, given a set of top-level package names to be
installed in the image. */ rpmDistros = {
diskImageFuns = { fedora2i386 = {
fedora2i386 = args: makeImageFromRPMDist ({
name = "fedora-core-2-i386"; name = "fedora-core-2-i386";
fullName = "Fedora Core 2 (i386)"; fullName = "Fedora Core 2 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -713,9 +716,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/core/2/i386/os; urlPrefix = mirror://fedora/linux/core/2/i386/os;
runScripts = false; runScripts = false;
} // args); packages = commonFedoraPackages;
};
fedora3i386 = args: makeImageFromRPMDist ({
fedora3i386 = {
name = "fedora-core-3-i386"; name = "fedora-core-3-i386";
fullName = "Fedora Core 3 (i386)"; fullName = "Fedora Core 3 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -725,9 +729,10 @@ rec {
urlPrefix = mirror://fedora/linux/core/3/i386/os; urlPrefix = mirror://fedora/linux/core/3/i386/os;
archs = ["noarch" "i386" "i586"]; archs = ["noarch" "i386" "i586"];
runScripts = false; runScripts = false;
} // args); packages = commonFedoraPackages;
};
fedora5i386 = args: makeImageFromRPMDist ({ fedora5i386 = {
name = "fedora-core-5-i386"; name = "fedora-core-5-i386";
fullName = "Fedora Core 5 (i386)"; fullName = "Fedora Core 5 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -735,9 +740,10 @@ rec {
sha256 = "0lfk4mzrpiyls8h7k9ckc3vgywbmg05zsr4ag6qakgnv9gljijig"; sha256 = "0lfk4mzrpiyls8h7k9ckc3vgywbmg05zsr4ag6qakgnv9gljijig";
}; };
urlPrefix = mirror://fedora/linux/core/5/i386/os; urlPrefix = mirror://fedora/linux/core/5/i386/os;
} // args); packages = commonFedoraPackages ++ [ "util-linux" ];
};
fedora7i386 = args: makeImageFromRPMDist ({ fedora7i386 = {
name = "fedora-7-i386"; name = "fedora-7-i386";
fullName = "Fedora 7 (i386)"; fullName = "Fedora 7 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -745,9 +751,10 @@ rec {
sha256 = "0zq7ifirj45wry7b2qkm12qhzzazal3hn610h5kwbrfr2xavs882"; sha256 = "0zq7ifirj45wry7b2qkm12qhzzazal3hn610h5kwbrfr2xavs882";
}; };
urlPrefix = mirror://fedora/linux/releases/7/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/7/Fedora/i386/os;
} // args); packages = commonFedoraPackages;
};
fedora8i386 = args: makeImageFromRPMDist ({ fedora8i386 = {
name = "fedora-8-i386"; name = "fedora-8-i386";
fullName = "Fedora 8 (i386)"; fullName = "Fedora 8 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -755,9 +762,10 @@ rec {
sha256 = "0vr9345rrk0vhs4pc9cjp8npdkqz0xqyirv84vhyfn533m9ws36f"; sha256 = "0vr9345rrk0vhs4pc9cjp8npdkqz0xqyirv84vhyfn533m9ws36f";
}; };
urlPrefix = mirror://fedora/linux/releases/8/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/8/Fedora/i386/os;
} // args); packages = commonFedoraPackages;
};
fedora9i386 = args: makeImageFromRPMDist ({ fedora9i386 = {
name = "fedora-9-i386"; name = "fedora-9-i386";
fullName = "Fedora 9 (i386)"; fullName = "Fedora 9 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -765,9 +773,10 @@ rec {
sha256 = "18780xgyag5acx79warcpvzlfkm0mni8xawl6jjvgxg9n3lp6zg0"; sha256 = "18780xgyag5acx79warcpvzlfkm0mni8xawl6jjvgxg9n3lp6zg0";
}; };
urlPrefix = mirror://fedora/linux/releases/9/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/9/Fedora/i386/os;
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora9x86_64 = args: makeImageFromRPMDist ({ fedora9x86_64 = {
name = "fedora-9-x86_64"; name = "fedora-9-x86_64";
fullName = "Fedora 9 (x86_64)"; fullName = "Fedora 9 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -776,9 +785,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/9/Fedora/x86_64/os; urlPrefix = mirror://fedora/linux/releases/9/Fedora/x86_64/os;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora10i386 = args: makeImageFromRPMDist ({ fedora10i386 = {
name = "fedora-10-i386"; name = "fedora-10-i386";
fullName = "Fedora 10 (i386)"; fullName = "Fedora 10 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -786,9 +796,10 @@ rec {
sha256 = "15ha8pxzvlch707mpy06c7pkr2ra2vpd5b8x30qhydvx8fgcqcx9"; sha256 = "15ha8pxzvlch707mpy06c7pkr2ra2vpd5b8x30qhydvx8fgcqcx9";
}; };
urlPrefix = mirror://fedora/linux/releases/10/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/10/Fedora/i386/os;
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora10x86_64 = args: makeImageFromRPMDist ({ fedora10x86_64 = {
name = "fedora-10-x86_64"; name = "fedora-10-x86_64";
fullName = "Fedora 10 (x86_64)"; fullName = "Fedora 10 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -797,9 +808,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/10/Fedora/x86_64/os; urlPrefix = mirror://fedora/linux/releases/10/Fedora/x86_64/os;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora11i386 = args: makeImageFromRPMDist ({ fedora11i386 = {
name = "fedora-11-i386"; name = "fedora-11-i386";
fullName = "Fedora 11 (i386)"; fullName = "Fedora 11 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -808,9 +820,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/11/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/11/Fedora/i386/os;
archs = ["noarch" "i386" "i586"]; archs = ["noarch" "i386" "i586"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora11x86_64 = args: makeImageFromRPMDist ({ fedora11x86_64 = {
name = "fedora-11-x86_64"; name = "fedora-11-x86_64";
fullName = "Fedora 11 (x86_64)"; fullName = "Fedora 11 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -819,9 +832,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/11/Fedora/x86_64/os; urlPrefix = mirror://fedora/linux/releases/11/Fedora/x86_64/os;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora12i386 = args: makeImageFromRPMDist ({ fedora12i386 = {
name = "fedora-12-i386"; name = "fedora-12-i386";
fullName = "Fedora 12 (i386)"; fullName = "Fedora 12 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -830,9 +844,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/12/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/12/Fedora/i386/os;
archs = ["noarch" "i386" "i586" "i686"]; archs = ["noarch" "i386" "i586" "i686"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora12x86_64 = args: makeImageFromRPMDist ({ fedora12x86_64 = {
name = "fedora-12-x86_64"; name = "fedora-12-x86_64";
fullName = "Fedora 12 (x86_64)"; fullName = "Fedora 12 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -841,9 +856,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/12/Fedora/x86_64/os; urlPrefix = mirror://fedora/linux/releases/12/Fedora/x86_64/os;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora13i386 = args: makeImageFromRPMDist ({ fedora13i386 = {
name = "fedora-13-i386"; name = "fedora-13-i386";
fullName = "Fedora 13 (i386)"; fullName = "Fedora 13 (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -852,9 +868,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/13/Fedora/i386/os; urlPrefix = mirror://fedora/linux/releases/13/Fedora/i386/os;
archs = ["noarch" "i386" "i586" "i686"]; archs = ["noarch" "i386" "i586" "i686"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
fedora13x86_64 = args: makeImageFromRPMDist ({ fedora13x86_64 = {
name = "fedora-13-x86_64"; name = "fedora-13-x86_64";
fullName = "Fedora 13 (x86_64)"; fullName = "Fedora 13 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -863,9 +880,10 @@ rec {
}; };
urlPrefix = mirror://fedora/linux/releases/13/Fedora/x86_64/os; urlPrefix = mirror://fedora/linux/releases/13/Fedora/x86_64/os;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ];
};
opensuse103i386 = args: makeImageFromRPMDist ({ opensuse103i386 = {
name = "opensuse-10.3-i586"; name = "opensuse-10.3-i586";
fullName = "openSUSE 10.3 (i586)"; fullName = "openSUSE 10.3 (i586)";
packagesList = fetchurl { packagesList = fetchurl {
@ -874,9 +892,10 @@ rec {
}; };
urlPrefix = mirror://opensuse/distribution/10.3/repo/oss/suse/; urlPrefix = mirror://opensuse/distribution/10.3/repo/oss/suse/;
archs = ["noarch" "i586"]; archs = ["noarch" "i586"];
} // args); packages = commonOpenSUSEPackages ++ [ "devs" ];
};
opensuse110i386 = args: makeImageFromRPMDist ({ opensuse110i386 = {
name = "opensuse-11.0-i586"; name = "opensuse-11.0-i586";
fullName = "openSUSE 11.0 (i586)"; fullName = "openSUSE 11.0 (i586)";
packagesList = fetchurl { packagesList = fetchurl {
@ -885,9 +904,10 @@ rec {
}; };
urlPrefix = mirror://opensuse/distribution/11.0/repo/oss/suse/; urlPrefix = mirror://opensuse/distribution/11.0/repo/oss/suse/;
archs = ["noarch" "i586"]; archs = ["noarch" "i586"];
} // args); packages = commonOpenSUSEPackages;
};
opensuse110x86_64 = args: makeImageFromRPMDist ({ opensuse110x86_64 = {
name = "opensuse-11.0-x86_64"; name = "opensuse-11.0-x86_64";
fullName = "openSUSE 11.0 (x86_64)"; fullName = "openSUSE 11.0 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -896,9 +916,10 @@ rec {
}; };
urlPrefix = mirror://opensuse/distribution/11.0/repo/oss/suse/; urlPrefix = mirror://opensuse/distribution/11.0/repo/oss/suse/;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonOpenSUSEPackages;
};
opensuse111i386 = args: makeImageFromRPMDist ({ opensuse111i386 = {
name = "opensuse-11.1-i586"; name = "opensuse-11.1-i586";
fullName = "openSUSE 11.1 (i586)"; fullName = "openSUSE 11.1 (i586)";
packagesList = fetchurl { packagesList = fetchurl {
@ -907,9 +928,10 @@ rec {
}; };
urlPrefix = mirror://opensuse/distribution/11.1/repo/oss/suse/; urlPrefix = mirror://opensuse/distribution/11.1/repo/oss/suse/;
archs = ["noarch" "i586"]; archs = ["noarch" "i586"];
} // args); packages = commonOpenSUSEPackages;
};
opensuse111x86_64 = args: makeImageFromRPMDist ({ opensuse111x86_64 = {
name = "opensuse-11.1-x86_64"; name = "opensuse-11.1-x86_64";
fullName = "openSUSE 11.1 (x86_64)"; fullName = "openSUSE 11.1 (x86_64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -918,13 +940,21 @@ rec {
}; };
urlPrefix = mirror://opensuse/distribution/11.1/repo/oss/suse/; urlPrefix = mirror://opensuse/distribution/11.1/repo/oss/suse/;
archs = ["noarch" "x86_64"]; archs = ["noarch" "x86_64"];
} // args); packages = commonOpenSUSEPackages;
};
};
/* The set of supported Dpkg-based distributions. */
debDistros = {
# Interestingly, the SHA-256 hashes provided by Ubuntu in # Interestingly, the SHA-256 hashes provided by Ubuntu in
# http://nl.archive.ubuntu.com/ubuntu/dists/{gutsy,hardy}/Release are # http://nl.archive.ubuntu.com/ubuntu/dists/{gutsy,hardy}/Release are
# wrong, but the SHA-1 and MD5 hashes are correct. Intrepid is fine. # wrong, but the SHA-1 and MD5 hashes are correct. Intrepid is fine.
ubuntu710i386 = args: makeImageFromDebDist ({ ubuntu710i386 = {
name = "ubuntu-7.10-gutsy-i386"; name = "ubuntu-7.10-gutsy-i386";
fullName = "Ubuntu 7.10 Gutsy (i386)"; fullName = "Ubuntu 7.10 Gutsy (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -932,9 +962,10 @@ rec {
sha1 = "8b52ee3d417700e2b2ee951517fa25a8792cabfd"; sha1 = "8b52ee3d417700e2b2ee951517fa25a8792cabfd";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu804i386 = args: makeImageFromDebDist ({ ubuntu804i386 = {
name = "ubuntu-8.04-hardy-i386"; name = "ubuntu-8.04-hardy-i386";
fullName = "Ubuntu 8.04 Hardy (i386)"; fullName = "Ubuntu 8.04 Hardy (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -942,9 +973,10 @@ rec {
sha1 = "db74581ee75cb3bee2a8ae62364e97956c723259"; sha1 = "db74581ee75cb3bee2a8ae62364e97956c723259";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu804x86_64 = args: makeImageFromDebDist ({ ubuntu804x86_64 = {
name = "ubuntu-8.04-hardy-amd64"; name = "ubuntu-8.04-hardy-amd64";
fullName = "Ubuntu 8.04 Hardy (amd64)"; fullName = "Ubuntu 8.04 Hardy (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -952,9 +984,10 @@ rec {
sha1 = "d1f1d2b3cc62533d6e4337f2696a5d27235d1f28"; sha1 = "d1f1d2b3cc62533d6e4337f2696a5d27235d1f28";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu810i386 = args: makeImageFromDebDist ({ ubuntu810i386 = {
name = "ubuntu-8.10-intrepid-i386"; name = "ubuntu-8.10-intrepid-i386";
fullName = "Ubuntu 8.10 Intrepid (i386)"; fullName = "Ubuntu 8.10 Intrepid (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -962,9 +995,10 @@ rec {
sha256 = "70483d40a9e9b74598f2faede7df5d5103ee60055af7374f8db5c7e6017c4cf6"; sha256 = "70483d40a9e9b74598f2faede7df5d5103ee60055af7374f8db5c7e6017c4cf6";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu810x86_64 = args: makeImageFromDebDist ({ ubuntu810x86_64 = {
name = "ubuntu-8.10-intrepid-amd64"; name = "ubuntu-8.10-intrepid-amd64";
fullName = "Ubuntu 8.10 Intrepid (amd64)"; fullName = "Ubuntu 8.10 Intrepid (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -972,9 +1006,10 @@ rec {
sha256 = "01b2f3842cbdd5834446ddf91691bcf60f59a726dcefa23fb5b93fdc8ea7e27f"; sha256 = "01b2f3842cbdd5834446ddf91691bcf60f59a726dcefa23fb5b93fdc8ea7e27f";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu904i386 = args: makeImageFromDebDist ({ ubuntu904i386 = {
name = "ubuntu-9.04-jaunty-i386"; name = "ubuntu-9.04-jaunty-i386";
fullName = "Ubuntu 9.04 Jaunty (i386)"; fullName = "Ubuntu 9.04 Jaunty (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -982,9 +1017,10 @@ rec {
sha256 = "72c95e4901ad56ce8791723e2ae40bce2399f306f9956cac80e964011e1948d0"; sha256 = "72c95e4901ad56ce8791723e2ae40bce2399f306f9956cac80e964011e1948d0";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu904x86_64 = args: makeImageFromDebDist ({ ubuntu904x86_64 = {
name = "ubuntu-9.04-jaunty-amd64"; name = "ubuntu-9.04-jaunty-amd64";
fullName = "Ubuntu 9.04 Jaunty (amd64)"; fullName = "Ubuntu 9.04 Jaunty (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -992,9 +1028,10 @@ rec {
sha256 = "af760ce04e43f066b8938b1abdeff979a642f940515659ede44f7877ca358ca8"; sha256 = "af760ce04e43f066b8938b1abdeff979a642f940515659ede44f7877ca358ca8";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebianPackages;
};
ubuntu910i386 = args: makeImageFromDebDist ({ ubuntu910i386 = {
name = "ubuntu-9.10-karmic-i386"; name = "ubuntu-9.10-karmic-i386";
fullName = "Ubuntu 9.10 Karmic (i386)"; fullName = "Ubuntu 9.10 Karmic (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1002,9 +1039,10 @@ rec {
sha256 = "6e3e813857496f2af6cd7e6ada06b3398fa067a7992c5fd7e8bd8fa92e3548b7"; sha256 = "6e3e813857496f2af6cd7e6ada06b3398fa067a7992c5fd7e8bd8fa92e3548b7";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebPackages ++ [ "diff" ];
};
ubuntu910x86_64 = args: makeImageFromDebDist ({ ubuntu910x86_64 = {
name = "ubuntu-9.10-karmic-amd64"; name = "ubuntu-9.10-karmic-amd64";
fullName = "Ubuntu 9.10 Karmic (amd64)"; fullName = "Ubuntu 9.10 Karmic (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1012,9 +1050,10 @@ rec {
sha256 = "3a604fcb0c135eeb8b95da3e90a8fd4cfeff519b858cd3c9e62ea808cb9fec40"; sha256 = "3a604fcb0c135eeb8b95da3e90a8fd4cfeff519b858cd3c9e62ea808cb9fec40";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebPackages ++ [ "diff" ];
};
ubuntu1004i386 = args: makeImageFromDebDist ({ ubuntu1004i386 = {
name = "ubuntu-10.04-lucid-i386"; name = "ubuntu-10.04-lucid-i386";
fullName = "Ubuntu 10.04 Lucid (i386)"; fullName = "Ubuntu 10.04 Lucid (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1022,9 +1061,10 @@ rec {
sha256 = "0e46596202a68caa754dfe0883f46047525309880c492cdd5e2d0970fcf626aa"; sha256 = "0e46596202a68caa754dfe0883f46047525309880c492cdd5e2d0970fcf626aa";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebPackages ++ [ "diffutils" ];
};
ubuntu1004x86_64 = args: makeImageFromDebDist ({ ubuntu1004x86_64 = {
name = "ubuntu-10.04-lucid-amd64"; name = "ubuntu-10.04-lucid-amd64";
fullName = "Ubuntu 10.04 Lucid (amd64)"; fullName = "Ubuntu 10.04 Lucid (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1032,9 +1072,10 @@ rec {
sha256 = "74a8f3192b0eda397d65316e0fa6cd34d5358dced41639e07d9f1047971bfef0"; sha256 = "74a8f3192b0eda397d65316e0fa6cd34d5358dced41639e07d9f1047971bfef0";
}; };
urlPrefix = mirror://ubuntu; urlPrefix = mirror://ubuntu;
} // args); packages = commonDebPackages ++ [ "diffutils" ];
};
debian40i386 = args: makeImageFromDebDist ({ debian40i386 = {
name = "debian-4.0r9-etch-i386"; name = "debian-4.0r9-etch-i386";
fullName = "Debian 4.0r9 Etch (i386)"; fullName = "Debian 4.0r9 Etch (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1042,9 +1083,10 @@ rec {
sha256 = "40eeeecc35e6895b6eb0bc601e38fe53fc985d1b1f3fea3766f34763d21f206f"; sha256 = "40eeeecc35e6895b6eb0bc601e38fe53fc985d1b1f3fea3766f34763d21f206f";
}; };
urlPrefix = mirror://debian; urlPrefix = mirror://debian;
} // args); packages = commonDebianPackages;
};
debian40x86_64 = args: makeImageFromDebDist ({ debian40x86_64 = {
name = "debian-4.0r9-etch-amd64"; name = "debian-4.0r9-etch-amd64";
fullName = "Debian 4.0r9 Etch (amd64)"; fullName = "Debian 4.0r9 Etch (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1052,9 +1094,10 @@ rec {
sha256 = "cf1c4c7d72e0da45797b046011254d2bd83f5ecb7389c7f30d2561be3f5b2e49"; sha256 = "cf1c4c7d72e0da45797b046011254d2bd83f5ecb7389c7f30d2561be3f5b2e49";
}; };
urlPrefix = mirror://debian; urlPrefix = mirror://debian;
} // args); packages = commonDebianPackages;
};
debian50i386 = args: makeImageFromDebDist ({ debian50i386 = {
name = "debian-5.0.4-lenny-i386"; name = "debian-5.0.4-lenny-i386";
fullName = "Debian 5.0.4 Lenny (i386)"; fullName = "Debian 5.0.4 Lenny (i386)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1062,9 +1105,10 @@ rec {
sha256 = "6c5ca67fb401a5d29f02557c290bbaee35c457172d548583b510d49eadd0f9ff"; sha256 = "6c5ca67fb401a5d29f02557c290bbaee35c457172d548583b510d49eadd0f9ff";
}; };
urlPrefix = mirror://debian; urlPrefix = mirror://debian;
} // args); packages = commonDebianPackages;
};
debian50x86_64 = args: makeImageFromDebDist ({ debian50x86_64 = {
name = "debian-5.0.4-lenny-amd64"; name = "debian-5.0.4-lenny-amd64";
fullName = "Debian 5.0.4 Lenny (amd64)"; fullName = "Debian 5.0.4 Lenny (amd64)";
packagesList = fetchurl { packagesList = fetchurl {
@ -1072,7 +1116,8 @@ rec {
sha256 = "c3b660b861ed257e82293a350ab868c2ce566bc084d35cc66b7388a881eaf3c5"; sha256 = "c3b660b861ed257e82293a350ab868c2ce566bc084d35cc66b7388a881eaf3c5";
}; };
urlPrefix = mirror://debian; urlPrefix = mirror://debian;
} // args); packages = commonDebianPackages;
};
}; };
@ -1100,6 +1145,7 @@ rec {
"unzip" "unzip"
]; ];
/* Common packages for openSUSE images. */ /* Common packages for openSUSE images. */
commonOpenSUSEPackages = [ commonOpenSUSEPackages = [
"aaa_base" "aaa_base"
@ -1125,12 +1171,11 @@ rec {
/* Common packages for Debian/Ubuntu images. */ /* Common packages for Debian/Ubuntu images. */
commonDebianPackages = [ commonDebPackages = [
"base-passwd" "base-passwd"
"dpkg" "dpkg"
"libc6-dev" "libc6-dev"
"perl" "perl"
"sysvinit"
"bash" "bash"
"dash" "dash"
"gzip" "gzip"
@ -1142,7 +1187,6 @@ rec {
"make" "make"
"curl" "curl"
"patch" "patch"
"diff"
"locales" "locales"
# Needed by checkinstall: # Needed by checkinstall:
"util-linux" "util-linux"
@ -1156,23 +1200,43 @@ rec {
"mktemp" "mktemp"
]; ];
commonDebianPackages = commonDebPackages ++ [ "sysvinit" "diff" ];
# Ubuntu 9.10 no longer has sysvinit.
karmicPackages = lib.filter (x: x != "sysvinit") commonDebianPackages;
lucidPackages = (lib.filter (x: x != "sysvinit" && x != "diff") commonDebianPackages) ++ [ "diffutils" ];
/* A bunch of disk images. */ /* A set of functions that build the Linux distributions specified
in `rpmDistros' and `debDistros'. For instance,
`diskImageFuns.ubuntu1004x86_64 { }' builds an Ubuntu 10.04 disk
image containing the default packages specified above. Overrides
of the default image parameters can be given. In particular,
`extraPackages' specifies the names of additional packages from
the distribution that should be included in the image; `packages'
allows the entire set of packages to be overriden; and `size'
sets the size of the disk in megabytes. E.g.,
`diskImageFuns.ubuntu1004x86_64 { extraPackages = ["firefox"];
size = 8192; }' builds an 8 GiB image containing Firefox in
addition to the default packages. */
diskImageFuns =
(lib.mapAttrs (name: as: as2: makeImageFromRPMDist (as // as2)) rpmDistros) //
(lib.mapAttrs (name: as: as2: makeImageFromDebDist (as // as2)) debDistros);
/* Shorthand for `diskImageFuns.<attr> { extraPackages = ... }'. */
diskImageExtraFuns =
lib.mapAttrs (name: f: extraPackages: f { inherit extraPackages; }) diskImageFuns;
/* Default disk images generated from the `rpmDistros' and
`debDistros' sets (along with Red Hat 9 and SuSE 9.0 images). */
diskImages = diskImages =
lib.mapAttrs (name: f: f {}) diskImageFuns //
{ redhat9i386 = fillDiskWithRPMs { { redhat9i386 = fillDiskWithRPMs {
name = "redhat-9-i386"; name = "redhat-9-i386";
fullName = "Red Hat Linux 9 (i386)"; fullName = "Red Hat Linux 9 (i386)";
size = 1024; size = 1024;
rpms = import ./rpm/redhat-9-i386.nix {inherit fetchurl;}; rpms = import ./rpm/redhat-9-i386.nix {inherit fetchurl;};
}; };
suse90i386 = fillDiskWithRPMs { suse90i386 = fillDiskWithRPMs {
name = "suse-9.0-i386"; name = "suse-9.0-i386";
@ -1193,47 +1257,7 @@ rec {
echo 'video:x:33:' >> /mnt/etc/group echo 'video:x:33:' >> /mnt/etc/group
''; '';
}; };
} // lib.mapAttrs (name: f: f []) diskImageExtraFuns; };
diskImageExtraFuns = {
fedora2i386 = extraVirtualPackages : diskImageFuns.fedora2i386 { packages = commonFedoraPackages ++ extraVirtualPackages; };
fedora3i386 = extraVirtualPackages : diskImageFuns.fedora3i386 { packages = commonFedoraPackages ++ extraVirtualPackages; };
fedora5i386 = extraVirtualPackages : diskImageFuns.fedora5i386 { packages = commonFedoraPackages ++ ["util-linux"] ++ extraVirtualPackages; };
fedora7i386 = extraVirtualPackages : diskImageFuns.fedora7i386 { packages = commonFedoraPackages ++ extraVirtualPackages; };
fedora8i386 = extraVirtualPackages : diskImageFuns.fedora8i386 { packages = commonFedoraPackages ++ extraVirtualPackages; };
fedora9i386 = extraVirtualPackages : diskImageFuns.fedora9i386 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora9x86_64 = extraVirtualPackages : diskImageFuns.fedora9x86_64 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora10i386 = extraVirtualPackages : diskImageFuns.fedora10i386 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora10x86_64 = extraVirtualPackages : diskImageFuns.fedora10x86_64 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora11i386 = extraVirtualPackages : diskImageFuns.fedora11i386 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora11x86_64 = extraVirtualPackages : diskImageFuns.fedora11x86_64 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora12i386 = extraVirtualPackages : diskImageFuns.fedora12i386 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora12x86_64 = extraVirtualPackages : diskImageFuns.fedora12x86_64 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora13i386 = extraVirtualPackages : diskImageFuns.fedora13i386 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
fedora13x86_64 = extraVirtualPackages : diskImageFuns.fedora13x86_64 { packages = commonFedoraPackages ++ [ "cronie" "util-linux-ng" ] ++ extraVirtualPackages; };
opensuse103i386 = extraVirtualPackages : diskImageFuns.opensuse103i386 { packages = commonOpenSUSEPackages ++ ["devs"] ++ extraVirtualPackages; };
opensuse110i386 = extraVirtualPackages : diskImageFuns.opensuse110i386 { packages = commonOpenSUSEPackages ++ extraVirtualPackages; };
opensuse110x86_64 = extraVirtualPackages : diskImageFuns.opensuse110x86_64 { packages = commonOpenSUSEPackages ++ extraVirtualPackages; };
opensuse111i386 = extraVirtualPackages : diskImageFuns.opensuse111i386 { packages = commonOpenSUSEPackages ++ extraVirtualPackages; };
opensuse111x86_64 = extraVirtualPackages : diskImageFuns.opensuse111x86_64 { packages = commonOpenSUSEPackages ++ extraVirtualPackages; };
ubuntu710i386 = extraVirtualPackages : diskImageFuns.ubuntu710i386 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu804i386 = extraVirtualPackages : diskImageFuns.ubuntu804i386 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu804x86_64 = extraVirtualPackages : diskImageFuns.ubuntu804x86_64 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu810i386 = extraVirtualPackages : diskImageFuns.ubuntu810i386 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu810x86_64 = extraVirtualPackages : diskImageFuns.ubuntu810x86_64 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu904i386 = extraVirtualPackages : diskImageFuns.ubuntu904i386 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu904x86_64 = extraVirtualPackages : diskImageFuns.ubuntu904x86_64 { packages = commonDebianPackages ++ extraVirtualPackages; };
ubuntu910i386 = extraVirtualPackages : diskImageFuns.ubuntu910i386 { packages = karmicPackages ++ extraVirtualPackages; };
ubuntu910x86_64 = extraVirtualPackages : diskImageFuns.ubuntu910x86_64 { packages = karmicPackages ++ extraVirtualPackages; };
ubuntu1004i386 = extraVirtualPackages : diskImageFuns.ubuntu1004i386 { packages = lucidPackages ++ extraVirtualPackages; };
ubuntu1004x86_64 = extraVirtualPackages : diskImageFuns.ubuntu1004x86_64 { packages = lucidPackages ++ extraVirtualPackages; };
debian40i386 = extraVirtualPackages : diskImageFuns.debian40i386 { packages = commonDebianPackages ++ extraVirtualPackages; };
debian40x86_64 = extraVirtualPackages : diskImageFuns.debian40x86_64 { packages = commonDebianPackages ++ extraVirtualPackages; };
debian50i386 = extraVirtualPackages : diskImageFuns.debian50i386 { packages = commonDebianPackages ++ extraVirtualPackages; };
debian50x86_64 = extraVirtualPackages : diskImageFuns.debian50x86_64 { packages = commonDebianPackages ++ extraVirtualPackages; };
};
} }