-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Special-case error message to add extra information
The Derivation parser and old ATerm unfortunately leaves few ways to get nice errors when an old version of Nix encounters a new version of the format. The most likely scenario for this to occur is with a new client making a derivation that the old daemon it is communicating with cannot understand. The extensions we just created for dynamic derivation deps will add a version field, solving the problem going forward, but there is still the issue of what to do about old versions of Nix up to now. The solution here is to carefully catch the bad error from the daemon that is likely to indicate this problem, and add some extra context to it. There is another "Ugly backwards compatibility hack" in `remote-store.cc` that also works by transforming an error. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
- Loading branch information
1 parent
7ad66cb
commit 80d7994
Showing
4 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
with import ./config.nix; | ||
|
||
# A simple content-addressed derivation. | ||
# The derivation can be arbitrarily modified by passing a different `seed`, | ||
# but the output will always be the same | ||
rec { | ||
stub = mkDerivation { | ||
name = "stub"; | ||
buildCommand = '' | ||
echo stub > $out | ||
''; | ||
}; | ||
wrapper = mkDerivation { | ||
name = "has-dynamic-drv-dep"; | ||
buildCommand = '' | ||
exit 1 # we're not building this derivation | ||
${builtins.outputOf stub.outPath "out"} | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Purposely bypassing our usual common for this subgroup | ||
source ../common.sh | ||
|
||
# Need backend to support text-hashing too | ||
isDaemonNewer "2.18.0pre20230906" && skipTest "Daemon is too new" | ||
|
||
enableFeatures "ca-derivations dynamic-derivations" | ||
|
||
restartDaemon | ||
|
||
expectStderr 1 nix-instantiate --read-write-mode ./old-daemon-error-hack.nix | grepQuiet "the daemon is too old to understand dependencies on dynamic derivations" |