fetchurl: fix resolvedUrl eval on URLs without mirror:// prefix

Without the change `resolvedUrl` fails on non-mirror:// packages as:

    $ nix eval --impure --expr 'with import ./. {}; AMB-plugins.src.resolvedUrl'
    error:
       ...
       error: expected a list but found null: null

After ther change the eval works as expected:

    $ nix eval --impure --expr 'with import ./. {}; AMB-plugins.src.resolvedUrl'
    "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/AMB-plugins-0.8.1.tar.bz2"
This commit is contained in:
Sergei Trofimovich 2025-08-05 09:21:41 +01:00
parent 17f65146e9
commit 425c7e46a0

View File

@ -203,7 +203,10 @@ let
else
throw "unknown mirror:// site ${mirrorName}";
in
if mirrorName == null then url else "${lib.head mirrorList}${lib.elemAt mirrorSplit 1}";
if mirrorSplit == null || mirrorName == null then
url
else
"${lib.head mirrorList}${lib.elemAt mirrorSplit 1}";
in
assert