diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-09-17 09:35:30 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-09-17 09:41:02 +0200 |
commit | 787469c7b66aec12ab6847e7db2cdc8aef5c325e (patch) | |
tree | eb2eb8f058ad7149befb6cf4fd1b582546e46569 /src/nix-channel | |
parent | 10d1865f5f443ddd57bb408a99f0afd74436e963 (diff) |
Remove corepkgs/unpack-channel.nix
Diffstat (limited to 'src/nix-channel')
-rwxr-xr-x | src/nix-channel/nix-channel.cc | 11 | ||||
-rw-r--r-- | src/nix-channel/unpack-channel.nix | 12 |
2 files changed, 21 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"); diff --git a/src/nix-channel/unpack-channel.nix b/src/nix-channel/unpack-channel.nix new file mode 100644 index 000000000..10515bc8b --- /dev/null +++ b/src/nix-channel/unpack-channel.nix @@ -0,0 +1,12 @@ +{ name, channelName, src }: + +derivation { + builder = "builtin:unpack-channel"; + + system = "builtin"; + + inherit name channelName src; + + # No point in doing this remotely. + preferLocalBuild = true; +} |