Skip to content

Commit

Permalink
bazelisk-env: fix gcc linking against nixos libc
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Sep 15, 2024
1 parent 53684fb commit bb3bf98
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkgs/bazelisk-env/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildFHSUserEnv {
targetPkgs = pkgs: with pkgs; [
# include no more than this
# crt1.o is already taken care of by buildFHSEnv.nix
gcc_multi.out
(pkgs.callPackage ./gcc_multi_patched.nix {})

binutils
pkg-config
Expand All @@ -38,6 +38,7 @@ buildFHSUserEnv {
which
python3
patch
curl

# debugging
iputils
Expand Down
23 changes: 23 additions & 0 deletions pkgs/bazelisk-env/gcc_multi_patched.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
gcc_multi,
stdenv,
}:

stdenv.mkDerivation {
name = gcc_multi.name + "-fhs";

src = gcc_multi;

buildPhase = ''
find . -type f -exec sed -i \
-e s,${gcc_multi.out},$out,g \
-e s,${gcc_multi.cc.lib},,g \
-e s,${gcc_multi.libc},,g \
-e s,${gcc_multi.libc.dev},/usr,g \
{} +
'';

installPhase = ''
cp -rp . $out
'';
}

0 comments on commit bb3bf98

Please sign in to comment.