-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3204bb0
commit 840ac9f
Showing
3 changed files
with
103 additions
and
0 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,69 @@ | ||
let | ||
# Pin some fairly new nixpkgs | ||
sources = builtins.fetchTarball { | ||
name = "nixpkgs-unstable-2021-07-06"; | ||
url = "https://github.com/nixos/nixpkgs/archive/291b3ff5af268eb7a656bb11c73f2fe535ea2170.tar.gz"; | ||
sha256 = "1z2l7q4cmiaqb99cd8yfisdr1n6xbwcczr9020ss47y2z1cn1x7x"; | ||
}; | ||
|
||
# For bootstrapping | ||
pkgs = import sources { | ||
overlays = [ | ||
(pkgs: super: { | ||
# TODO replace with proper packaging once https://github.com/NixOS/nixpkgs/pull/128889 is merged | ||
mold = pkgs.stdenv.mkDerivation { | ||
pname = "mold"; | ||
version = "0.9.1"; | ||
src = ./.; | ||
nativeBuildInputs = with pkgs; [ clang_12 cmake lld_12 tbb xxHash zlib openssl git ]; | ||
dontUseCmakeConfigure = "true"; | ||
buildPhase = "make -j $NIX_BUILD_CORES"; | ||
installPhase = "mkdir -p $out $out/bin $out/share/man/man1 && PREFIX=$out make install"; | ||
}; | ||
|
||
binutils_mold = pkgs.wrapBintoolsWith { | ||
bintools = pkgs.binutils-unwrapped.overrideAttrs (old: { | ||
postInstall = '' | ||
rm $out/bin/ld.gold | ||
rm $out/bin/ld.bfd | ||
ln -sf ${pkgs.mold}/bin/mold $out/bin/ld.bfd | ||
''; | ||
}); | ||
}; | ||
|
||
stdenv_mold = super.overrideCC super.stdenv (super.wrapCCWith rec { | ||
cc = super.gcc-unwrapped; | ||
bintools = pkgs.binutils_mold; | ||
}); | ||
}) | ||
]; | ||
}; | ||
|
||
# Actual nixpkgs with patched linker in all packages | ||
pkgsMold = import sources { | ||
overlays = [ | ||
(self: super: { | ||
stdenv = pkgs.stdenv_mold; | ||
mold = pkgs.mold; | ||
}) | ||
]; | ||
}; | ||
|
||
# Like pkgsMold, but we disable mold individually for known failing packages until their issues are resolved | ||
pkgsMoldCI = pkgsMold.appendOverlays [ | ||
(self: super: { | ||
inherit (pkgs) | ||
valgrind # https://github.com/rui314/mold/issues/81#issuecomment-876425070 | ||
; | ||
}) | ||
]; | ||
in { | ||
inherit pkgs pkgsMold pkgsMoldCI; | ||
|
||
# Packages we already know that work in order to catch regressions | ||
ciPackages = with pkgsMoldCI; linkFarmFromDrvs "packages-with-mold" [ | ||
binutils | ||
stdenv | ||
# TODO | ||
]; | ||
} |