Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions lib/mk-aggregated.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{ lib, stdenv, symlinkJoin, pkgsTargetTarget, bash, curl, rustc }:
{ lib, stdenv, buildEnv, pkgsTargetTarget, bash, curl, rustc }:
{ pname, version, date, selectedComponents, availableComponents ? selectedComponents }:
let
inherit (lib) optional;
inherit (stdenv) targetPlatform;
in
symlinkJoin {
(buildEnv {
name = pname + "-" + version;
inherit pname version;

Expand All @@ -24,23 +24,6 @@ symlinkJoin {
badTargetPlatforms = rustc.badTargetPlatforms or [ ];
};

# Ourselves have offset -1. In order to make these offset -1 dependencies of downstream derivation,
# they are offset 0 propagated.

# CC for build script linking.
# Workaround: should be `pkgsHostHost.cc` but `stdenv`'s cc itself have -1 offset.
depsHostHostPropagated = [ stdenv.cc ];

# CC for crate linking.
# Workaround: should be `pkgsHostTarget.cc` but `stdenv`'s cc itself have -1 offset.
# N.B. WASM targets don't need our CC.
propagatedBuildInputs =
optional (!targetPlatform.isWasm) pkgsTargetTarget.stdenv.cc;

# Link dependency for target, required by darwin std.
depsTargetTargetPropagated =
optional (targetPlatform.isDarwin) pkgsTargetTarget.libiconv;

# If rustc or rustdoc is in the derivation, we need to copy their
# executable into the final derivation. This is required
# for making them find the correct SYSROOT.
Expand Down Expand Up @@ -97,12 +80,29 @@ symlinkJoin {
--replace "@out@" "$out"
fi

# symlinkJoin doesn't automatically handle it. Thus do it manually.
# buildEnv doesn't automatically handle it. Thus do it manually.
mkdir -p $out/nix-support
echo "$depsHostHostPropagated " >$out/nix-support/propagated-host-host-deps
[[ -z "$propagatedBuildInputs" ]] || echo "$propagatedBuildInputs " >$out/nix-support/propagated-build-inputs
[[ -z "$depsTargetTargetPropagated" ]] || echo "$depsTargetTargetPropagated " >$out/nix-support/propagated-target-target-deps
'';
}).overrideAttrs {
# Ourselves have offset -1. In order to make these offset -1 dependencies of downstream derivation,
# they are offset 0 propagated.

# CC for build script linking.
# Workaround: should be `pkgsHostHost.cc` but `stdenv`'s cc itself have -1 offset.
depsHostHostPropagated = [ stdenv.cc ];

# CC for crate linking.
# Workaround: should be `pkgsHostTarget.cc` but `stdenv`'s cc itself have -1 offset.
# N.B. WASM targets don't need our CC.
propagatedBuildInputs =
optional (!targetPlatform.isWasm) pkgsTargetTarget.stdenv.cc;

# Link dependency for target, required by darwin std.
depsTargetTargetPropagated =
optional (targetPlatform.isDarwin) pkgsTargetTarget.libiconv;

meta.platforms = lib.platforms.all;
}