forked from DeterminateSystems/nix-installer
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
installer script: try fixing intermittent errors
- Loading branch information
1 parent
97ff33a
commit e4781c4
Showing
1 changed file
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
import requests | ||
import subprocess | ||
import shutil | ||
import sys | ||
|
||
response = requests.get('https://hydra.nixos.org/jobset/experimental-nix-installer/experimental-installer/evals', headers={'Accept': 'application/json'}) | ||
|
||
hydra_eval = response.json()['evals'][0] | ||
|
||
installers = [] | ||
|
||
for build_id in hydra_eval['builds']: | ||
response = requests.get(f"https://hydra.nixos.org/build/{build_id}", headers={'Accept': 'application/json'}) | ||
build = response.json() | ||
installer_url = build['buildoutputs']['out']['path'] | ||
system = build['system'] | ||
subprocess.call(f"nix-store -r {installer_url}", shell=True) | ||
if build['finished'] == "1": | ||
try: | ||
subprocess.call(f"nix-store -r {installer_url}", shell=True) | ||
except: | ||
# retry once | ||
subprocess.call(f"nix-store -r {installer_url}", shell=True) | ||
installers.append((installer_url, system)) | ||
else: | ||
sys.exit(0) | ||
|
||
shutil.copy(f"{installer_url}/bin/nix-installer", f"nix-installer-{system}") | ||
for installer_url, system in installers: | ||
shutil.copy(f"{installer_url}/bin/nix-installer", f"nix-installer-{system}") |