1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

nix-prefetch-url: Add --name option

This allows overriding the name component of the resulting Nix store
path, which is necessary if the base name of the URI contains
"illegal" characters.
This commit is contained in:
Eelco Dolstra 2015-10-07 14:55:33 +02:00
parent e4abf8610b
commit f08449ccbd
2 changed files with 19 additions and 3 deletions

View file

@ -75,6 +75,8 @@ int main(int argc, char * * argv)
}
else if (*arg == "--unpack")
unpack = true;
else if (*arg == "--name")
name = getArg(*arg, arg, end);
else if (parseAutoArgs(arg, end, autoArgs_))
;
else if (parseSearchPathArg(arg, end, searchPath))
@ -125,9 +127,11 @@ int main(int argc, char * * argv)
unpack = state.forceString(*attr->value) == "recursive";
/* Extract the name. */
attr = v.attrs->find(state.symbols.create("name"));
if (attr != v.attrs->end())
name = state.forceString(*attr->value);
if (name.empty()) {
attr = v.attrs->find(state.symbols.create("name"));
if (attr != v.attrs->end())
name = state.forceString(*attr->value);
}
}
/* Figure out a name in the Nix store. */