discourse/update.py: use nix-instantiate

The interface of `nix eval` is not stable across versions of nix that
are currently in the wild, so use the older nix-instantiate command
instead.
This commit is contained in:
Ryan Mulligan 2021-11-16 15:59:32 -08:00
parent 59e5ab0290
commit 88120a1377

View File

@ -79,7 +79,7 @@ def _call_nix_update(pkg, version):
def _nix_eval(expr: str):
nixpkgs_path = Path(__file__).parent / '../../../../'
try:
output = subprocess.check_output(['nix', 'eval', '--json', f'(with import {nixpkgs_path} {{}}; {expr})'], text=True)
output = subprocess.check_output(['nix-instantiate', '--strict', '--json', '--eval', '-E', f'(with import {nixpkgs_path} {{}}; {expr})'], text=True)
except subprocess.CalledProcessError:
return None
return json.loads(output)