aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.version2
-rw-r--r--doc/manual/src/SUMMARY.md.in1
-rw-r--r--doc/manual/src/release-notes/rl-2.9.md47
-rw-r--r--doc/manual/src/release-notes/rl-next.md41
-rw-r--r--flake.lock10
-rw-r--r--flake.nix9
-rw-r--r--src/libcmd/installables.cc9
-rw-r--r--src/libexpr/eval.cc1
-rw-r--r--src/libexpr/eval.hh3
-rw-r--r--src/libexpr/get-drvs.cc37
-rw-r--r--src/libstore/http-binary-cache-store.cc7
-rw-r--r--src/libstore/remote-store.cc50
12 files changed, 126 insertions, 91 deletions
diff --git a/.version b/.version
index f3ac133c5..f161b5d80 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.9.0 \ No newline at end of file
+2.10.0 \ No newline at end of file
diff --git a/doc/manual/src/SUMMARY.md.in b/doc/manual/src/SUMMARY.md.in
index 860222337..825a8b4c0 100644
--- a/doc/manual/src/SUMMARY.md.in
+++ b/doc/manual/src/SUMMARY.md.in
@@ -72,6 +72,7 @@
- [CLI guideline](contributing/cli-guideline.md)
- [Release Notes](release-notes/release-notes.md)
- [Release X.Y (202?-??-??)](release-notes/rl-next.md)
+ - [Release 2.9 (2022-05-30)](release-notes/rl-2.9.md)
- [Release 2.8 (2022-04-19)](release-notes/rl-2.8.md)
- [Release 2.7 (2022-03-07)](release-notes/rl-2.7.md)
- [Release 2.6 (2022-01-24)](release-notes/rl-2.6.md)
diff --git a/doc/manual/src/release-notes/rl-2.9.md b/doc/manual/src/release-notes/rl-2.9.md
new file mode 100644
index 000000000..98cc4235d
--- /dev/null
+++ b/doc/manual/src/release-notes/rl-2.9.md
@@ -0,0 +1,47 @@
+# Release 2.9 (2022-05-30)
+
+* Running Nix with the new `--debugger` flag will cause it to start a
+ repl session if an exception is thrown during evaluation, or if
+ `builtins.break` is called. From there you can inspect the values
+ of variables and evaluate Nix expressions. In debug mode, the
+ following new repl commands are available:
+
+ ```
+ :env Show env stack
+ :bt Show trace stack
+ :st Show current trace
+ :st <idx> Change to another trace in the stack
+ :c Go until end of program, exception, or builtins.break().
+ :s Go one step
+ ```
+
+ Read more about the debugger
+ [here](https://www.zknotes.com/note/5970).
+
+* Nix now provides better integration with zsh's `run-help`
+ feature. It is now included in the Nix installation in the form of
+ an autoloadable shell function, `run-help-nix`. It picks up Nix
+ subcommands from the currently typed in command and directs the user
+ to the associated man pages.
+
+* `nix repl` has a new build-and-link (`:bl`) command that builds a
+ derivation while creating GC root symlinks.
+
+* The path produced by `builtins.toFile` is now allowed to be imported
+ or read even with restricted evaluation. Note that this will not
+ work with a read-only store.
+
+* `nix build` has a new `--print-out-paths` flag to print the
+ resulting output paths. This matches the default behaviour of
+ `nix-build`.
+
+* You can now specify which outputs of a derivation `nix` should
+ operate on using the syntax `installable^outputs`,
+ e.g. `nixpkgs#glibc^dev,static` or `nixpkgs#glibc^*`. By default,
+ `nix` will use the outputs specified by the derivation's
+ `meta.outputsToInstall` attribute if it exists, or all outputs
+ otherwise.
+
+* `builtins.fetchTree` (and flake inputs) can now be used to fetch
+ plain files over the `http(s)` and `file` protocols in addition to
+ directory tarballs.
diff --git a/doc/manual/src/release-notes/rl-next.md b/doc/manual/src/release-notes/rl-next.md
index 878916dc9..c869b5e2f 100644
--- a/doc/manual/src/release-notes/rl-next.md
+++ b/doc/manual/src/release-notes/rl-next.md
@@ -1,42 +1 @@
# Release X.Y (202?-??-??)
-
-* Nix now provides better integration with zsh's run-help feature. It is now
- included in the Nix installation in the form of an autoloadable shell
- function, run-help-nix. It picks up Nix subcommands from the currently typed
- in command and directs the user to the associated man pages.
-
-* `nix repl` has a new build-'n-link (`:bl`) command that builds a derivation
- while creating GC root symlinks.
-
-* The path produced by `builtins.toFile` is now allowed to be imported or read
- even with restricted evaluation. Note that this will not work with a
- read-only store.
-
-* `nix build` has a new `--print-out-paths` flag to print the resulting output paths.
- This matches the default behaviour of `nix-build`.
-
-* You can now specify which outputs of a derivation `nix` should
- operate on using the syntax `installable^outputs`,
- e.g. `nixpkgs#glibc^dev,static` or `nixpkgs#glibc^*`. By default,
- `nix` will use the outputs specified by the derivation's
- `meta.outputsToInstall` attribute if it exists, or all outputs
- otherwise.
-
- Selecting derivation outputs using the attribute selection syntax
- (e.g. `nixpkgs#glibc.dev`) no longer works.
-
-* Running nix with the new `--debugger` flag will cause it to start a repl session if
- there is an exception thrown during eval, or if `builtins.break` is called. From
- there one can inspect symbol values and evaluate nix expressions. In debug mode
- the following new repl commands are available:
- ```
- :env Show env stack
- :bt Show trace stack
- :st Show current trace
- :st <idx> Change to another trace in the stack
- :c Go until end of program, exception, or builtins.break().
- :s Go one step
- ```
-
-* `builtins.fetchTree` (and flake inputs) can now be used to fetch plain files
- over the `http(s)` and `file` protocols in addition to directory tarballs.
diff --git a/flake.lock b/flake.lock
index cd79fa85e..31c1910df 100644
--- a/flake.lock
+++ b/flake.lock
@@ -26,9 +26,10 @@
"type": "github"
},
"original": {
- "id": "nixpkgs",
+ "owner": "NixOS",
"ref": "nixos-21.05-small",
- "type": "indirect"
+ "repo": "nixpkgs",
+ "type": "github"
}
},
"nixpkgs-regression": {
@@ -41,9 +42,10 @@
"type": "github"
},
"original": {
- "id": "nixpkgs",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "indirect"
+ "type": "github"
}
},
"root": {
diff --git a/flake.nix b/flake.nix
index 77b016ff0..a69969cfa 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,8 +1,8 @@
{
description = "The purely functional package manager";
- inputs.nixpkgs.url = "nixpkgs/nixos-21.05-small";
- inputs.nixpkgs-regression.url = "nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05-small";
+ inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
inputs.lowdown-src = { url = "github:kristapsdz/lowdown"; flake = false; };
outputs = { self, nixpkgs, nixpkgs-regression, lowdown-src }:
@@ -348,7 +348,7 @@
strictDeps = true;
- passthru.perl-bindings = with final; currentStdenv.mkDerivation {
+ passthru.perl-bindings = with final; perl.pkgs.toPerlModule (currentStdenv.mkDerivation {
name = "nix-perl-${version}";
src = self;
@@ -378,8 +378,9 @@
enableParallelBuilding = true;
postUnpack = "sourceRoot=$sourceRoot/perl";
- };
+ });
+ meta.platforms = systems;
};
lowdown-nix = with final; currentStdenv.mkDerivation rec {
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index 635ce19b6..21db2b08b 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -623,7 +623,14 @@ std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableF
std::set<std::string> outputsToInstall;
std::optional<NixInt> priority;
- if (auto aMeta = attr->maybeGetAttr(state->sMeta)) {
+ if (auto aOutputSpecified = attr->maybeGetAttr(state->sOutputSpecified)) {
+ if (aOutputSpecified->getBool()) {
+ if (auto aOutputName = attr->maybeGetAttr("outputName"))
+ outputsToInstall = { aOutputName->getString() };
+ }
+ }
+
+ else if (auto aMeta = attr->maybeGetAttr(state->sMeta)) {
if (auto aOutputsToInstall = aMeta->maybeGetAttr("outputsToInstall"))
for (auto & s : aOutputsToInstall->getListOfStrings())
outputsToInstall.insert(s);
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 18baf1cb7..40462afdf 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -459,6 +459,7 @@ EvalState::EvalState(
, sKey(symbols.create("key"))
, sPath(symbols.create("path"))
, sPrefix(symbols.create("prefix"))
+ , sOutputSpecified(symbols.create("outputSpecified"))
, repair(NoRepair)
, emptyBindings(0)
, store(store)
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 0a32d5885..7b8732169 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -103,7 +103,8 @@ public:
sOutputHash, sOutputHashAlgo, sOutputHashMode,
sRecurseForDerivations,
sDescription, sSelf, sEpsilon, sStartSet, sOperator, sKey, sPath,
- sPrefix;
+ sPrefix,
+ sOutputSpecified;
Symbol sDerivationNix;
/* If set, force copying files to the Nix store even if they
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index d616b3921..346741dd5 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -132,23 +132,36 @@ DrvInfo::Outputs DrvInfo::queryOutputs(bool withPaths, bool onlyOutputsToInstall
} else
outputs.emplace("out", withPaths ? std::optional{queryOutPath()} : std::nullopt);
}
+
if (!onlyOutputsToInstall || !attrs)
return outputs;
- /* Check for `meta.outputsToInstall` and return `outputs` reduced to that. */
- const Value * outTI = queryMeta("outputsToInstall");
- if (!outTI) return outputs;
- const auto errMsg = Error("this derivation has bad 'meta.outputsToInstall'");
- /* ^ this shows during `nix-env -i` right under the bad derivation */
- if (!outTI->isList()) throw errMsg;
- Outputs result;
- for (auto elem : outTI->listItems()) {
- if (elem->type() != nString) throw errMsg;
- auto out = outputs.find(elem->string.s);
- if (out == outputs.end()) throw errMsg;
+ Bindings::iterator i;
+ if (attrs && (i = attrs->find(state->sOutputSpecified)) != attrs->end() && state->forceBool(*i->value, i->pos)) {
+ Outputs result;
+ auto out = outputs.find(queryOutputName());
+ if (out == outputs.end())
+ throw Error("derivation does not have output '%s'", queryOutputName());
result.insert(*out);
+ return result;
+ }
+
+ else {
+ /* Check for `meta.outputsToInstall` and return `outputs` reduced to that. */
+ const Value * outTI = queryMeta("outputsToInstall");
+ if (!outTI) return outputs;
+ const auto errMsg = Error("this derivation has bad 'meta.outputsToInstall'");
+ /* ^ this shows during `nix-env -i` right under the bad derivation */
+ if (!outTI->isList()) throw errMsg;
+ Outputs result;
+ for (auto elem : outTI->listItems()) {
+ if (elem->type() != nString) throw errMsg;
+ auto out = outputs.find(elem->string.s);
+ if (out == outputs.end()) throw errMsg;
+ result.insert(*out);
+ }
+ return result;
}
- return result;
}
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 3cb5efdbf..73bcd6e81 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -161,7 +161,12 @@ protected:
void getFile(const std::string & path,
Callback<std::optional<std::string>> callback) noexcept override
{
- checkEnabled();
+ try {
+ checkEnabled();
+ } catch (...) {
+ callback.rethrow();
+ return;
+ }
auto request(makeRequest(path));
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 14aeba75c..bc36aef5d 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -718,36 +718,34 @@ void RemoteStore::registerDrvOutput(const Realisation & info)
void RemoteStore::queryRealisationUncached(const DrvOutput & id,
Callback<std::shared_ptr<const Realisation>> callback) noexcept
{
- auto conn(getConnection());
+ try {
+ auto conn(getConnection());
- if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 27) {
- warn("the daemon is too old to support content-addressed derivations, please upgrade it to 2.4");
- try {
- callback(nullptr);
- } catch (...) { return callback.rethrow(); }
- }
+ if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 27) {
+ warn("the daemon is too old to support content-addressed derivations, please upgrade it to 2.4");
+ return callback(nullptr);
+ }
- conn->to << wopQueryRealisation;
- conn->to << id.to_string();
- conn.processStderr();
+ conn->to << wopQueryRealisation;
+ conn->to << id.to_string();
+ conn.processStderr();
- auto real = [&]() -> std::shared_ptr<const Realisation> {
- if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 31) {
- auto outPaths = worker_proto::read(
- *this, conn->from, Phantom<std::set<StorePath>> {});
- if (outPaths.empty())
- return nullptr;
- return std::make_shared<const Realisation>(Realisation { .id = id, .outPath = *outPaths.begin() });
- } else {
- auto realisations = worker_proto::read(
- *this, conn->from, Phantom<std::set<Realisation>> {});
- if (realisations.empty())
- return nullptr;
- return std::make_shared<const Realisation>(*realisations.begin());
- }
- }();
+ auto real = [&]() -> std::shared_ptr<const Realisation> {
+ if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 31) {
+ auto outPaths = worker_proto::read(
+ *this, conn->from, Phantom<std::set<StorePath>> {});
+ if (outPaths.empty())
+ return nullptr;
+ return std::make_shared<const Realisation>(Realisation { .id = id, .outPath = *outPaths.begin() });
+ } else {
+ auto realisations = worker_proto::read(
+ *this, conn->from, Phantom<std::set<Realisation>> {});
+ if (realisations.empty())
+ return nullptr;
+ return std::make_shared<const Realisation>(*realisations.begin());
+ }
+ }();
- try {
callback(std::shared_ptr<const Realisation>(real));
} catch (...) { return callback.rethrow(); }
}