nixpkgs/pkgs/stdenv/linux/bootstrap/powerpc/default.nix
Shea Levy 986f361946 linux/bootstrap: Use <nix/fetchurl> to get the static binaries
Since nix-1.4, nix's corepkgs contain a fetchurl suitable for
downloading the bootstrap binaries. Doing this will allow us to have a
nixpkgs with no in-tree binaries without breaking the purity of the
bootstrap (though for now, they are fetched in-tree until the binaries
are added to nixos.org somewhere). As an additional small benefit, the
in-tree binaries do not have to be hashed on every instantiation as they
do now.

The fetchurl in nix-1.2 and 1.3 isn't able to make binaries executable,
so it can't be used for this case. In that case, attempting to build the
bootstrap will show a message asking the user to manually download each
file and add it to the store with nix-store --add (but the hash is
ultimately the same, of course).

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-05-05 11:30:34 -04:00

80 lines
2 KiB
Nix

let
fetch = { file, sha256 }:
let
nixFetchurl = import <nix/fetchurl.nix>;
args = {
url = "file://${builtins.toString ./.}/${file}";
inherit sha256;
executable = true;
};
in if (builtins.functionArgs nixFetchurl) ? executable
then nixFetchurl args
else derivation {
name = file;
builder = "/bin/sh";
system = builtins.currentSystem;
args = [ "-c" "echo $message; exit 1" ];
message = ''
Sorry, this version of nix cannot download all of the bootstrap tools.
Please download ${args.url}, make it executable, add it to the store
with `nix-store --add', and try again.
'';
outputHashAlgo = "sha256";
outputHash = args.sha256;
outputHashMode = "recursive";
preferLocalBuild = true;
};
in {
bash = fetch {
file = "bash";
sha256 = "0zss8im6hbx6z2i2wxn1554kd7ggdqdli4xk39cy5fchlnz9bqpp";
};
bzip2 = fetch {
file = "bzip2";
sha256 = "01ylj8x7albv6k9sqx2h1prsazh4d8y22nga0pwai2bnns0q9qdg";
};
cp = fetch {
file = "cp";
sha256 = "0d7xbzrv22bxgw7w9b03rakirna5zfvr9gzwm7ichd2fh634hvgl";
};
curl = fetch {
file = "curl.bz2";
sha256 = "17c25dfslw3qkjlcmihpbhn3x4kj9pgkslizv89ggnki7iiy4jgh";
};
tar = fetch {
file = "tar.bz2";
sha256 = "132ylqwz02hw5njqx7wvj4sxpcrllx8b8b3a00rlv6iad671ayyr";
};
staticToolsURL = {
url = http://nixos.org/tarballs/stdenv-linux/powerpc/r9828/static-tools.tar.bz2;
sha1 = "e4d1680e3dfa752e49a996a31140db53b10061cb";
};
binutilsURL = {
url = http://nixos.org/tarballs/stdenv-linux/powerpc/r9828/binutils.tar.bz2;
sha1 = "2609f4d9277a60fcd178395d3d49911190e08f36";
};
gccURL = {
url = http://nixos.org/tarballs/stdenv-linux/powerpc/r9828/gcc.tar.bz2;
sha1 = "71d79d736bfef6252208fe6239e528a591becbed";
};
glibcURL = {
url = http://nixos.org/tarballs/stdenv-linux/powerpc/r9828/glibc.tar.bz2;
sha1 = "bf0245e16235800c8aa9c6a5de6565583a66e46d";
};
}