mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
Support netrc in <nix/fetchurl.nix>
This allows <nix/fetchurl.nix> to fetch private Git/Mercurial
repositories, e.g.
import <nix/fetchurl.nix> {
url = 80a14018da
.tar.bz2;
sha256 = "1mgqzn7biqkq3hf2697b0jc4wabkqhmzq2srdymjfa6sb9zb6qs7";
}
where /etc/nix/netrc contains:
machine bitbucket.org
login edolstra
password blabla...
This works even when sandboxing is enabled.
To do: add unpacking support (i.e. fetchzip functionality).
This commit is contained in:
parent
cde4b60919
commit
302386f775
5 changed files with 25 additions and 7 deletions
|
@ -288,9 +288,9 @@ string readFile(const Path & path, bool drain)
|
|||
}
|
||||
|
||||
|
||||
void writeFile(const Path & path, const string & s)
|
||||
void writeFile(const Path & path, const string & s, mode_t mode)
|
||||
{
|
||||
AutoCloseFD fd = open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0666);
|
||||
AutoCloseFD fd = open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, mode);
|
||||
if (!fd)
|
||||
throw SysError(format("opening file ‘%1%’") % path);
|
||||
writeFull(fd.get(), s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue