diff options
author | zimbatm <zimbatm@zimbatm.com> | 2020-11-06 11:53:00 +0100 |
---|---|---|
committer | zimbatm <zimbatm@zimbatm.com> | 2020-11-21 19:56:46 +0100 |
commit | 233b61d3d6482544c35b9d340240bf3260acff13 (patch) | |
tree | 7f5d5af1210c06d2c47038dc18ddaae91289d1c5 /scripts/install.in | |
parent | 4dcb183af31d5cb33b6ef8e581e77d1c892a58b9 (diff) |
installer: simplify the per-build installation
The goal is to allow the installation and testing of arbitrary Nix
versions. Extend the base installer to accept a `--tarball-url-prefix
<url>` to change where the Nix tarball is getting downloaded from.
Once this is merged it should allow to:
1. Pick an evaluation at https://hydra.nixos.org/jobset/nix/master that
looks healthy
2. Select the installedScript build and find the store path.
Now equipped with all of this, use an instance of nar-serve to fetch the
install script and release tarballs:
curl -sfL https://nar-serve.numtide.com/nix/store/rkv4yh7pym941bhj0849zqdkg2546bdv-installer-script/install \
| sh --tarball-url-prefix https://nar-serve.numtide.com/nix/store
Or with cachix, strip the /nix/store and derivation name and then:
curl -sfL https://mycache.cachix.org/serve/rkv4yh7pym941bhj0849zqdkg2546bdv/install \
| sh --tarball-url-prefix https://mycache.cachix.org/serve
Fixes #4047
Diffstat (limited to 'scripts/install.in')
-rw-r--r-- | scripts/install.in | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/scripts/install.in b/scripts/install.in index 9a281d776..7c3b795cc 100644 --- a/scripts/install.in +++ b/scripts/install.in @@ -25,18 +25,47 @@ require_util() { } case "$(uname -s).$(uname -m)" in - Linux.x86_64) system=x86_64-linux; hash=@binaryTarball_x86_64-linux@;; - Linux.i?86) system=i686-linux; hash=@binaryTarball_i686-linux@;; - Linux.aarch64) system=aarch64-linux; hash=@binaryTarball_aarch64-linux@;; - Darwin.x86_64) system=x86_64-darwin; hash=@binaryTarball_x86_64-darwin@;; - # eventually maybe: system=arm64-darwin; hash=@binaryTarball_arm64-darwin@;; - Darwin.arm64) system=x86_64-darwin; hash=@binaryTarball_x86_64-darwin@;; + Linux.x86_64) + hash=@tarballHash_x86_64-linux@ + path=@tarballPath_x86_64-linux@ + system=x86_64-linux + ;; + Linux.i?86) + hash=@tarballHash_i686-linux@ + path=@tarballPath_i686-linux@ + system=i686-linux + ;; + Linux.aarch64) + hash=@tarballHash_aarch64-linux@ + path=@tarballPath_aarch64-linux@ + system=aarch64-linux + ;; + Darwin.x86_64) + hash=@tarballHash_x86_64-darwin@ + path=@tarballPath_x86_64-darwin@ + system=x86_64-darwin + ;; + Darwin.arm64) + hash=@binaryTarball_x86_64-darwin@ + path=@tarballPath_x86_64-darwin@ + # eventually maybe: arm64-darwin + system=x86_64-darwin + ;; *) oops "sorry, there is no binary distribution of Nix for your platform";; esac -url="https://releases.nixos.org/nix/nix-@nixVersion@/nix-@nixVersion@-$system.tar.xz" +# Use this command-line option to fetch the tarballs using nar-serve or Cachix +if "${1:---tarball-url-prefix}"; then + if [ -z "${2:-}" ]; then + oops "missing argument for --tarball-url-prefix" + fi + url=${2}/${path} + shift 2 +else + url=https://releases.nixos.org/nix/nix-@nixVersion@/nix-@nixVersion@-$system.tar.xz +fi -tarball="$tmpDir/$(basename "$tmpDir/nix-@nixVersion@-$system.tar.xz")" +tarball=$tmpDir/nix-@nixVersion@-$system.tar.xz require_util curl "download the binary tarball" require_util tar "unpack the binary tarball" @@ -68,6 +97,7 @@ tar -xJf "$tarball" -C "$unpack" || oops "failed to unpack '$url'" script=$(echo "$unpack"/*/install) [ -e "$script" ] || oops "installation script is missing from the binary tarball!" +export INVOKED_FROM_INSTALL_IN=1 "$script" "$@" } # End of wrapping |