diff options
author | Shea Levy <shea@shealevy.com> | 2013-05-05 11:30:34 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2013-05-05 11:30:34 -0400 |
commit | 986f36194650e2a41451cbfb9f29ce1c66a62df3 (patch) | |
tree | d2af7d2778ef7c56022172eae4967bccf5e0fa8a /pkgs/stdenv/linux | |
parent | 6b78544addd4f46f7ad073fb7de83d0bb8b8de30 (diff) | |
download | nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.tar nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.tar.gz nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.tar.bz2 nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.tar.lz nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.tar.xz nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.tar.zst nixlib-986f36194650e2a41451cbfb9f29ce1c66a62df3.zip |
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>
Diffstat (limited to 'pkgs/stdenv/linux')
-rw-r--r-- | pkgs/stdenv/linux/bootstrap/armv5tel/default.nix | 69 | ||||
-rw-r--r-- | pkgs/stdenv/linux/bootstrap/armv6l/default.nix | 10 | ||||
-rw-r--r-- | pkgs/stdenv/linux/bootstrap/i686/default.nix | 70 | ||||
-rw-r--r-- | pkgs/stdenv/linux/bootstrap/loongson2f/default.nix | 70 | ||||
-rw-r--r-- | pkgs/stdenv/linux/bootstrap/powerpc/default.nix | 64 |
5 files changed, 249 insertions, 34 deletions
diff --git a/pkgs/stdenv/linux/bootstrap/armv5tel/default.nix b/pkgs/stdenv/linux/bootstrap/armv5tel/default.nix index 3a8a03e5a541..342a612d2181 100644 --- a/pkgs/stdenv/linux/bootstrap/armv5tel/default.nix +++ b/pkgs/stdenv/linux/bootstrap/armv5tel/default.nix @@ -1,10 +1,65 @@ -{ - sh = ./sh; - bzip2 = ./bzip2; - mkdir = ./mkdir; - cpio = ./cpio; - ln = ./ln; - curl = ./curl.bz2; +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 { + sh = fetch { + file = "sh"; + sha256 = "1kv3gc8h209rjc5i0rzzc4pjxq23kzq25iff89in05c9vl20mn4n"; + }; + + bzip2 = fetch { + file = "bzip2"; + sha256 = "090jrj099wl33q0iq092iljilam39pv8acli59m2af0fa9z0d9f0"; + }; + + mkdir = fetch { + file = "mkdir"; + sha256 = "01s8myfvi559dsxvbanxw71vxzjv49k4gi1qh0ak6l0qx0xq602b"; + }; + + cpio = fetch { + file = "cpio"; + sha256 = "07snc8l0mn84w2xrvdmc5yfpmlbrvl2bar8wipbpvm43nzz2qbzs"; + }; + + ln = fetch { + file = "ln"; + sha256 = "0m9fz02bashpfgwfkxmrp4wa8a5r3il52bclvf6z36vsam0vx56d"; + }; + + curl = fetch { + file = "curl.bz2"; + sha256 = "19yqdjqi31zlnqn8ss2ml60iq2a1vrwfw6dmvjqp6qbxmh7yb8n8"; + }; bootstrapTools = { url = "http://nixos.org/tarballs/stdenv-linux/armv5tel/r18744/bootstrap-tools.cpio.bz2"; diff --git a/pkgs/stdenv/linux/bootstrap/armv6l/default.nix b/pkgs/stdenv/linux/bootstrap/armv6l/default.nix index ecda6be8bd32..542f74de49fe 100644 --- a/pkgs/stdenv/linux/bootstrap/armv6l/default.nix +++ b/pkgs/stdenv/linux/bootstrap/armv6l/default.nix @@ -1,11 +1,7 @@ -{ - sh = ../armv5tel/sh; - bzip2 = ../armv5tel/bzip2; - mkdir = ../armv5tel/mkdir; - cpio = ../armv5tel/cpio; - ln = ../armv5tel/ln; - curl = ../armv5tel/curl.bz2; +# Use the static tools for armv5tel-linux. +(import ../armv5tel) // +{ bootstrapTools = { # Built from make-bootstrap-tools-crosspi.nix # nixpkgs rev eb0422e4c1263a65a9b2b954fe10a1e03d67db3e diff --git a/pkgs/stdenv/linux/bootstrap/i686/default.nix b/pkgs/stdenv/linux/bootstrap/i686/default.nix index 1d709766bfdc..0dee92d22492 100644 --- a/pkgs/stdenv/linux/bootstrap/i686/default.nix +++ b/pkgs/stdenv/linux/bootstrap/i686/default.nix @@ -1,10 +1,66 @@ -{ - sh = ./sh; - bzip2 = ./bzip2; - mkdir = ./mkdir; - cpio = ./cpio; - ln = ./ln; - curl = ./curl.bz2; +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 { + sh = fetch { + file = "sh"; + sha256 = "1l6sdhyqjlh4m5gj3pfpi8aisp1m012lpwxfcc4v1x8g429mflmy"; + }; + + bzip2 = fetch { + file = "bzip2"; + sha256 = "1p5nkrdn52jm6rsx8x3wwjpsh83f2qsjl1qckkgnkplwhj23zjp7"; + }; + + mkdir = fetch { + file = "mkdir"; + sha256 = "02ff7i9ph9ahiapsg2v9c3pwr7sl73sk4n7ic112ljkrgwkail33"; + }; + + cpio = fetch { + file = "cpio"; + sha256 = "046if3aqqramyhrn2yxrjf4bfkl8x1bcqxhvi7ml9nrv9smx8irg"; + }; + + ln = fetch { + file = "ln"; + sha256 = "06vr474i3x55p0rnqa87yx7dzf4qdfpfg201mks39id43cjm9f8j"; + }; + + curl = fetch { + file = "curl.bz2"; + sha256 = "1v0yfb4gcdyqpl2fxlxjh337r28c23iqm7vwck4p4643xd55di7q"; + }; bootstrapTools = { url = http://nixos.org/tarballs/stdenv-linux/i686/r24519/bootstrap-tools.cpio.bz2; diff --git a/pkgs/stdenv/linux/bootstrap/loongson2f/default.nix b/pkgs/stdenv/linux/bootstrap/loongson2f/default.nix index b0ad8d6545d5..4d7594f02ad4 100644 --- a/pkgs/stdenv/linux/bootstrap/loongson2f/default.nix +++ b/pkgs/stdenv/linux/bootstrap/loongson2f/default.nix @@ -1,10 +1,66 @@ -{ - sh = ./sh; - bzip2 = ./bzip2; - mkdir = ./mkdir; - cpio = ./cpio; - ln = ./ln; - curl = ./curl.bz2; +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 { + sh = fetch { + file = "sh"; + sha256 = "02jjl49wdq85pgh61aqf78yaknn9mi3rcspbpk7hs9c4mida2rhf"; + }; + + bzip2 = fetch { + file = "bzip2"; + sha256 = "1qn27y3amj9c6mnjk2kyb59y0d2w4yv16z9apaxx91hyq19gf29z"; + }; + + mkdir = fetch { + file = "mkdir"; + sha256 = "1vbp2bv9hkyb2fwl8hjrffpywn1wrl1kc4yrwi2lirawlnc6kymh"; + }; + + cpio = fetch { + file = "cpio"; + sha256 = "0mqxwdx0sl7skxx6049mk35l7d0fnibqsv174284kdp4p7iixwa0"; + }; + + ln = fetch { + file = "ln"; + sha256 = "05lwx8qvga3yv8xhs8bjgsfygsfrcxsfck0lxw6gsdckx25fgi7s"; + }; + + curl = fetch { + file = "curl.bz2"; + sha256 = "0iblnz4my54gryac04i64fn3ksi9g3dx96yjq93fj39z6kx6151c"; + }; bootstrapTools = { url = "http://nixos.org/tarballs/stdenv-linux/loongson2f/r22849/cross-bootstrap-tools.cpio.bz2"; diff --git a/pkgs/stdenv/linux/bootstrap/powerpc/default.nix b/pkgs/stdenv/linux/bootstrap/powerpc/default.nix index 61f7f8635128..59fa47561dd4 100644 --- a/pkgs/stdenv/linux/bootstrap/powerpc/default.nix +++ b/pkgs/stdenv/linux/bootstrap/powerpc/default.nix @@ -1,9 +1,61 @@ -{ - bash = ./bash; - bzip2 = ./bzip2; - cp = ./cp; - curl = ./curl.bz2; - tar = ./tar.bz2; +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; |