aboutsummaryrefslogtreecommitdiff
path: root/src/nix-channel/nix-channel.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-23 22:35:41 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-23 22:35:41 +0000
commit45ca7c3e4b92bbafbfa8e30513c9dd3cfe76e3f1 (patch)
tree687ae85bfed1558f05880dfdb8bc358520134c52 /src/nix-channel/nix-channel.cc
parente61061c88e0dfcce9329ea9f0b041a35270dfa1a (diff)
parent8d9402f411643c451cf2a0776afcb3a1af0f9a8c (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'src/nix-channel/nix-channel.cc')
-rwxr-xr-xsrc/nix-channel/nix-channel.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc
index 3ccf620c9..e48f7af9a 100755
--- a/src/nix-channel/nix-channel.cc
+++ b/src/nix-channel/nix-channel.cc
@@ -76,6 +76,13 @@ static void update(const StringSet & channelNames)
auto store = openStore();
+ auto [fd, unpackChannelPath] = createTempFile();
+ writeFull(fd.get(),
+ #include "unpack-channel.nix.gen.hh"
+ );
+ fd = -1;
+ AutoDelete del(unpackChannelPath, false);
+
// Download each channel.
Strings exprs;
for (const auto & channel : channels) {
@@ -104,7 +111,7 @@ static void update(const StringSet & channelNames)
bool unpacked = false;
if (std::regex_search(filename, std::regex("\\.tar\\.(gz|bz2|xz)$"))) {
- runProgram(settings.nixBinDir + "/nix-build", false, { "--no-out-link", "--expr", "import <nix/unpack-channel.nix> "
+ runProgram(settings.nixBinDir + "/nix-build", false, { "--no-out-link", "--expr", "import " + unpackChannelPath +
"{ name = \"" + cname + "\"; channelName = \"" + name + "\"; src = builtins.storePath \"" + filename + "\"; }" });
unpacked = true;
}
@@ -125,7 +132,7 @@ static void update(const StringSet & channelNames)
// Unpack the channel tarballs into the Nix store and install them
// into the channels profile.
std::cerr << "unpacking channels...\n";
- Strings envArgs{ "--profile", profile, "--file", "<nix/unpack-channel.nix>", "--install", "--from-expression" };
+ Strings envArgs{ "--profile", profile, "--file", unpackChannelPath, "--install", "--from-expression" };
for (auto & expr : exprs)
envArgs.push_back(std::move(expr));
envArgs.push_back("--quiet");