mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-24 14:56:15 +02:00
04b113f6cb
Fix #6209 When trying to run `nix log <installable>`, try first to resolve the derivation pointed to by `<installable>` as it is the resolved one that holds the build log. This has a couple of shortcomings: 1. It’s expensive as it requires re-reading the derivation 2. It’s brittle because if the derivation doesn’t exist anymore or can’t be resolved (which is the case if any one of its build inputs is missing), then we can’t access the log anymore However, I don’t think we can do better (at least not right now). The alternatives I see are: 1. Copy the build log for the un-resolved derivation. But that means a lot of duplication 2. Store the results of the resolving in the db. Which might be the best long-term solution, but leads to a whole new class of potential issues.
59 lines
1.4 KiB
Nix
59 lines
1.4 KiB
Nix
{ busybox, contentAddressed ? false }:
|
|
|
|
with import ./config.nix;
|
|
|
|
let
|
|
|
|
caArgs = if contentAddressed then {
|
|
outputHashMode = "recursive";
|
|
outputHashAlgo = "sha256";
|
|
__contentAddressed = true;
|
|
} else {};
|
|
|
|
mkDerivation = args:
|
|
derivation ({
|
|
inherit system;
|
|
builder = busybox;
|
|
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
|
|
} // removeAttrs args ["builder" "meta" "passthru"]
|
|
// caArgs)
|
|
// { meta = args.meta or {}; passthru = args.passthru or {}; };
|
|
|
|
input1 = mkDerivation {
|
|
shell = busybox;
|
|
name = "build-remote-input-1";
|
|
buildCommand = "echo hi-input1; echo FOO > $out";
|
|
requiredSystemFeatures = ["foo"];
|
|
};
|
|
|
|
input2 = mkDerivation {
|
|
shell = busybox;
|
|
name = "build-remote-input-2";
|
|
buildCommand = "echo hi; echo BAR > $out";
|
|
requiredSystemFeatures = ["bar"];
|
|
};
|
|
|
|
input3 = mkDerivation {
|
|
shell = busybox;
|
|
name = "build-remote-input-3";
|
|
buildCommand = ''
|
|
echo hi-input3
|
|
read x < ${input2}
|
|
echo $x BAZ > $out
|
|
'';
|
|
requiredSystemFeatures = ["baz"];
|
|
};
|
|
|
|
in
|
|
|
|
mkDerivation {
|
|
shell = busybox;
|
|
name = "build-remote";
|
|
passthru = { inherit input1 input2 input3; };
|
|
buildCommand =
|
|
''
|
|
read x < ${input1}
|
|
read y < ${input3}
|
|
echo "$x $y" > $out
|
|
'';
|
|
}
|