mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
* Allow '<nixexpr>' syntax to be used in nix-instantiate, nix-build
and nix-env, e.g., $ nix-env -f '<nixpkgs>' -i patchelf or $ nix-build '<nixos/tests>' -A login.test
This commit is contained in:
parent
23c38a04cc
commit
b12b21825c
5 changed files with 16 additions and 4 deletions
|
@ -44,4 +44,15 @@ bool parseSearchPathArg(const string & arg, Strings::iterator & i,
|
|||
}
|
||||
|
||||
|
||||
Path lookupFileArg(EvalState & state, string s)
|
||||
{
|
||||
if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
|
||||
Path p = state.findFile(s.substr(1, s.size() - 2));
|
||||
if (p == "") throw Error(format("file `%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)") % p);
|
||||
return p;
|
||||
} else
|
||||
return absPath(s);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue