Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 0a5ceed

Browse files
committed
Hacks for allowing images to work in GitHub Actions
1 parent 579a9c0 commit 0a5ceed

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

image.nix

+12-1
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,17 @@ let
4646

4747
# Dynamic files in the filesystem root of the base image
4848
dynamicRootFiles = pkgs.runCommandNoCC "dynamic-root-files" {} ''
49-
mkdir -p $out/run $out/usr/bin $out/bin
49+
mkdir -p $out/run $out/usr/bin $out/bin $out/lib64
5050
cp -R -Ls ${env} $out/run/profile
5151
cp -R -Ls ${env}/etc $out/etc
5252
ln -s ${pkgs.coreutils}/bin/env $out/usr/bin/env
5353
ln -s ${pkgs.bashInteractive}/bin/sh $out/bin/sh
54+
55+
# So that this image can be used as a GitHub Action container directly
56+
# Needed because it calls its own (non-nix-patched) node binary which uses
57+
# this dynamic linker path. See also the LD_LIBRARY_PATH assignment below,
58+
# which provides the necessary libraries for that binary
59+
ln -s ${pkgs.glibc}/lib/ld-linux-x86-64.so.2 $out/lib64/ld-linux-x86-64.so.2
5460
'';
5561

5662
# All contents of the root filesystem
@@ -115,6 +121,11 @@ in pkgs.dockerTools.buildImage {
115121
"USER=root"
116122
# Needed by some nix commands like nix-store to display output
117123
"PAGER=/run/profile/bin/less"
124+
# By default, the linker added in dynamicRootFiles can only find glibc
125+
# libraries, but the node binary from the GitHub Actions runner also
126+
# depends on libstdc++.so.6, which is glibc/stdenv. Using LD_LIBRARY_PATH
127+
# is the easiest way to inject this dependency
128+
"LD_LIBRARY_PATH=${lib.makeLibraryPath [ pkgs.stdenv.cc.cc ]}"
118129
];
119130
} // lib.optionalAttrs (nixHash != null) {
120131
# Embed a nixHash into the image if given, allowing later extraction via skopeo inspect

0 commit comments

Comments
 (0)