1
0
Fork 0

build(flake): Switch to nixpkgs's wrapped mold linker

By now a wrapped version of mold exists, which thus works with the
NixOS libraries. This is obviously the same as my self-wrapped version,
but vendoring is just not important here.
This commit is contained in:
Benedikt Peetz 2023-10-31 18:55:18 +01:00
parent 66e3b362c3
commit 196c392f59
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
1 changed files with 1 additions and 23 deletions

View File

@ -37,28 +37,6 @@
... ...
}: }:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
inherit (pkgs) lib;
bintools-wrapper = "${nixpkgs}/pkgs/build-support/bintools-wrapper";
mold' = pkgs.symlinkJoin {
name = "mold";
paths = [pkgs.mold];
nativeBuildInputs = [pkgs.makeWrapper];
suffixSalt = lib.replaceStrings ["-" "."] ["_" "_"] pkgs.targetPlatform.config;
postBuild = ''
for bin in ${pkgs.mold}/bin/*; do
rm $out/bin/"$(basename "$bin")"
export prog="$bin"
substituteAll "${bintools-wrapper}/ld-wrapper.sh" $out/bin/"$(basename "$bin")"
chmod +x $out/bin/"$(basename "$bin")"
mkdir -p $out/nix-support
substituteAll "${bintools-wrapper}/add-flags.sh" $out/nix-support/add-flags.sh
substituteAll "${bintools-wrapper}/add-hardening.sh" $out/nix-support/add-hardening.sh
substituteAll "${bintools-wrapper}/../wrapper-common/utils.bash" $out/nix-support/utils.bash
done
'';
};
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [(import rust-overlay)]; overlays = [(import rust-overlay)];
@ -79,7 +57,7 @@
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
mold' mold-wrapped
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
openssl openssl