Change:
I'm trying out the new Julia framework, but the following command fails Am I doing it wrong? If I only ask for the "Plots" package it works. <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Please run and paste the result. Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
Are you doing any overrides?
Hmm, this is arising from a Julia artifact in here: The artifact URL is given as The Nix code we generate as part of the Julia machinery looks like this: The URL seems to be valid. The problem seems to be that it doesn't end in . So the Nix derivation downloads it, but doesn't unzip or untar it, which is why we run into a problem in the . I'm thinking we need to stick a into the call. I'll try this in a bit.
This works for this example if I add a name ending with . The problem, of course, is that Julia artifacts are not necessarily tarballs, but can be arbitrary files. I think what we need to do is parse the artifact URL and determine if it's an archive that the default knows how to handle. If so, we keep using the current derivation, and otherwise replace it with a plain call. Per the , the supported archive extensions are: ? The manual may not perfectly match the actual code; the relevant part of the default is .
No
Unfortunately I've found another failing case, unrelated to the previous (it fails with PR ) It fails to build , likely for the reason I reported in PR
Hi should I open another issue for ?
Or just reopen this one and use it as a tracker for future issues?
Let's reopen this one for the known issues.
This problem is due to the upstream issue where it can't precompile in a headless environment, as discussed originally in . It's also mentioned in the . The workaround is to use . Maybe we could open a Nixpkgs issue to track the upstream issue, but I view this primarily as an upstream problem.
You are right, I forgot about the workaround. Disabling pre-compilation works indeed.

Discussion:
import subprocess import sys import toml <ins> from urllib.parse import urlparse </ins> import yaml import dag <ins> # This should match the behavior of the default unpackPhase. # See https://github.com/NixOS/nixpkgs/blob/59fa082abdbf462515facc8800d517f5728c909d/pkgs/stdenv/generic/setup.sh#L1044 archive_extensions = [ # xz extensions ".tar.xz", ".tar.lzma", ".txz", # *.tar or *.tar.* ".tar", ".tar.Z", ".tar.bz2", ".tar.gz", # Other tar extensions ".tgz", ".tbz2", ".tbz", ".zip" ] </ins> dependencies_path = Path(sys.argv[1]) closure_yaml_path = Path(sys.argv[2]) julia_path = Path(sys.argv[3])

if contents.get("depends_on"): closure_dependencies_dag.add_node(uuid, dependencies=contents["depends_on"].values()) <del> with open(out_path, "w") as f: f.write("{ lib, fetchurl, glibc, pkgs, stdenv }:nn") f.write("rec {n") def process_item(item): uuid, src = item lines = [] artifacts = toml.loads(subprocess.check_output([julia_path, extract_artifacts_script, uuid, src]).decode()) if not artifacts: return f'  uuid-{uuid} = {{}};n' lines.append(f'  uuid-{uuid} = {{') for artifact_name, details in artifacts.items(): if len(details["download"]) == 0: continue download = details["download"][0] url = download["url"] sha256 = download["sha256"] git_tree_sha1 = details["git-tree-sha1"] depends_on = set() if closure_dependencies_dag.has_node(uuid): depends_on = set(closure_dependencies_dag.get_dependencies(uuid)).intersection(dependency_uuids) </del> <ins> def get_archive_derivation(uuid, artifact_name, url, sha256): depends_on = set() if closure_dependencies_dag.has_node(uuid): depends_on = set(closure_dependencies_dag.get_dependencies(uuid)).intersection(dependency_uuids) </ins> <del> other_libs = extra_libs.get(uuid, []) </del> <ins> other_libs = extra_libs.get(uuid, []) </ins> <del> fixup = f"""fixupPhase = let </del> <ins> fixup = f"""fixupPhase = let </ins> libs = lib.concatMap (lib.mapAttrsToList (k: v: v.path)) [{" ".join(["uuid-" + x for x in depends_on])}]; in ''

patchelf --set-interpreter ${{glibc}}/lib/ld-linux-x86-64.so.2 {{}} ; ''""" <del> derivation = f"""{{ </del> <ins> return f"""stdenv.mkDerivation {{ </ins> name = "{artifact_name}"; src = fetchurl {{ url = "{url}";

{fixup}; }}""" <ins> def get_plain_derivation(url, sha256): return f"""fetchurl {{ url = "{url}"; sha256 = "{sha256}"; }}""" with open(out_path, "w") as f: f.write("{ lib, fetchurl, glibc, pkgs, stdenv }:nn") f.write("rec {n") def process_item(item): uuid, src = item lines = [] artifacts = toml.loads(subprocess.check_output([julia_path, extract_artifacts_script, uuid, src]).decode()) if not artifacts: return f'  uuid-{uuid} = {{}};n' lines.append(f'  uuid-{uuid} = {{') for artifact_name, details in artifacts.items(): if len(details["download"]) == 0: continue download = details["download"][0] url = download["url"] sha256 = download["sha256"] git_tree_sha1 = details["git-tree-sha1"] parsed_url = urlparse(url) if any(parsed_url.path.endswith(x) for x in archive_extensions): derivation = get_archive_derivation(uuid, artifact_name, url, sha256) else: derivation = get_plain_derivation(url, sha256) </ins> lines.append(f"""    "{artifact_name}" = {{ sha1 = "{git_tree_sha1}"; <del> path = stdenv.mkDerivation {derivation}; </del> <ins> path = {derivation}; </ins> }};n""") lines.append('  };n')