Skip to content

Commit

Permalink
installer script: try fixing intermittent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Mar 8, 2024
1 parent 97ff33a commit e4781c4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions assemble_installer.py
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}")

0 comments on commit e4781c4

Please sign in to comment.