Skip to content

Commit 97487c5

Browse files
authored
Merge pull request #36 from DeterminateSystems/deprecate-channel-urls
Warn about the use of channel URLs
2 parents 6468ece + 797c716 commit 97487c5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/libexpr/eval-settings.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,17 @@ bool EvalSettings::isPseudoUrl(std::string_view s)
8484

8585
std::string EvalSettings::resolvePseudoUrl(std::string_view url)
8686
{
87-
if (hasPrefix(url, "channel:"))
88-
return "https://nixos.org/channels/" + std::string(url.substr(8)) + "/nixexprs.tar.xz";
89-
else
87+
if (hasPrefix(url, "channel:")) {
88+
auto realUrl = "https://nixos.org/channels/" + std::string(url.substr(8)) + "/nixexprs.tar.xz";
89+
static bool haveWarned = false;
90+
warnOnce(haveWarned,
91+
"Channels are deprecated in favor of flakes in Determinate Nix. "
92+
"Instead of '%s', use '%s'. "
93+
"For a guide on Nix flakes, see: https://zero-to-nix.com/. "
94+
"For details and to offer feedback on the deprecation process, see: https://github.com/DeterminateSystems/nix-src/issues/34.",
95+
url, realUrl);
96+
return realUrl;
97+
} else
9098
return std::string(url);
9199
}
92100

@@ -103,4 +111,4 @@ Path getNixDefExpr()
103111
: getHome() + "/.nix-defexpr";
104112
}
105113

106-
} // namespace nix
114+
} // namespace nix

0 commit comments

Comments
 (0)