
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19
.tar.gz \
--argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
result/bin/apply-formatting $NIXPKGS_PATH
86 lines
2.2 KiB
Nix
86 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
swift,
|
|
useSwiftDriver ? true,
|
|
swift-driver,
|
|
}:
|
|
|
|
stdenv.mkDerivation (
|
|
swift._wrapperParams
|
|
// {
|
|
pname = "swift-wrapper";
|
|
inherit (swift) version meta;
|
|
|
|
outputs = [
|
|
"out"
|
|
"man"
|
|
];
|
|
|
|
# Wrapper and setup hook variables.
|
|
inherit swift;
|
|
inherit (swift)
|
|
swiftOs
|
|
swiftArch
|
|
swiftModuleSubdir
|
|
swiftLibSubdir
|
|
swiftStaticModuleSubdir
|
|
swiftStaticLibSubdir
|
|
;
|
|
swiftDriver = lib.optionalString useSwiftDriver "${swift-driver}/bin/swift-driver";
|
|
|
|
env.darwinMinVersion = lib.optionalString stdenv.targetPlatform.isDarwin (
|
|
stdenv.targetPlatform.darwinMinVersion
|
|
);
|
|
|
|
passAsFile = [ "buildCommand" ];
|
|
buildCommand = ''
|
|
mkdir -p $out/bin $out/nix-support
|
|
|
|
# Symlink all Swift binaries first.
|
|
# NOTE: This specifically omits clang binaries. We want to hide these for
|
|
# private use by Swift only.
|
|
ln -s -t $out/bin/ $swift/bin/swift*
|
|
|
|
# Replace specific binaries with wrappers.
|
|
for executable in swift swiftc swift-frontend; do
|
|
export prog=$swift/bin/$executable
|
|
rm $out/bin/$executable
|
|
substituteAll '${./wrapper.sh}' $out/bin/$executable
|
|
chmod a+x $out/bin/$executable
|
|
done
|
|
|
|
${lib.optionalString useSwiftDriver ''
|
|
# Symlink swift-driver executables.
|
|
ln -s -t $out/bin/ ${swift-driver}/bin/*
|
|
''}
|
|
|
|
ln -s ${swift.man} $man
|
|
|
|
# This link is here because various tools (swiftpm) check for stdlib
|
|
# relative to the swift compiler. It's fine if this is for build-time
|
|
# stuff, but we should patch all cases were it would end up in an output.
|
|
ln -s ${swift.lib}/lib $out/lib
|
|
|
|
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
|
|
|
|
# Propagate any propagated inputs from the unwrapped Swift compiler, if any.
|
|
if [ -e "$swift/nix-support" ]; then
|
|
for input in "$swift/nix-support/"*propagated*; do
|
|
cp "$input" "$out/nix-support/$(basename "$input")"
|
|
done
|
|
fi
|
|
'';
|
|
|
|
passthru = {
|
|
inherit swift;
|
|
inherit (swift)
|
|
swiftOs
|
|
swiftArch
|
|
swiftModuleSubdir
|
|
swiftLibSubdir
|
|
;
|
|
};
|
|
}
|
|
)
|