summaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2020-11-06 11:53:00 +0100
committerzimbatm <zimbatm@zimbatm.com>2020-11-21 19:56:46 +0100
commit233b61d3d6482544c35b9d340240bf3260acff13 (patch)
tree7f5d5af1210c06d2c47038dc18ddaae91289d1c5 /flake.nix
parent4dcb183af31d5cb33b6ef8e581e77d1c892a58b9 (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 'flake.nix')
-rw-r--r--flake.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 653cacded..7311a2471 100644
--- a/flake.nix
+++ b/flake.nix
@@ -324,9 +324,26 @@
''
mkdir -p $out/nix-support
+ # Converts /nix/store/50p3qk8kka9dl6wyq40vydq945k0j3kv-nix-2.4pre20201102_550e11f/bin/nix
+ # To 50p3qk8kka9dl6wyq40vydq945k0j3kv/bin/nix
+ tarballPath() {
+ # Remove the store prefix
+ local path=''${1#${builtins.storeDir}/}
+ # Get the path relative to the derivation root
+ local rest=''${path#*/}
+ # Get the derivation hash
+ local drvHash=''${path%%-*}
+ echo "$drvHash/$rest"
+ }
+
substitute ${./scripts/install.in} $out/install \
${pkgs.lib.concatMapStrings
- (system: "--replace '@binaryTarball_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${self.hydraJobs.binaryTarball.${system}}/*.tar.xz) ")
+ (system:
+ '' \
+ --replace '@tarballHash_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${self.hydraJobs.binaryTarball.${system}}/*.tar.xz) \
+ --replace '@tarballPath_${system}@' $(tarballPath ${self.hydraJobs.binaryTarball.${system}}/*.tar.xz) \
+ ''
+ )
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
} \
--replace '@nixVersion@' ${version}