about summary refs log tree commit diff
path: root/tools/nixery/prepare-image/prepare-image.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/nixery/prepare-image/prepare-image.nix')
-rw-r--r--tools/nixery/prepare-image/prepare-image.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/nixery/prepare-image/prepare-image.nix b/tools/nixery/prepare-image/prepare-image.nix
index 316bfbbf2712..56f9e7a3bf5c 100644
--- a/tools/nixery/prepare-image/prepare-image.nix
+++ b/tools/nixery/prepare-image/prepare-image.nix
@@ -132,6 +132,18 @@ let
   contentsEnv = symlinkJoin {
     name = "bulk-layers";
     paths = allContents.contents;
+
+    # Ensure that there is always a /usr/bin/env for shell scripts
+    # that require it.
+    #
+    # Note that images which do not actually contain `coreutils` will
+    # still have this symlink, but it will be dangling.
+    #
+    # TODO(tazjin): Don't link this if coreutils is not included.
+    postBuild = ''
+      mkdir -p $out/usr/bin
+      ln -s ${coreutils}/bin/env $out/usr/bin/env
+    '';
   };
 
   # Image layer that contains the symlink forest created above. This