@@ -4,6 +4,14 @@ drv:
44let
55 component = drv.config;
66
7+ subdir =
8+ if drv?source
9+ then
10+ drv.srcSubDir or ""
11+ else
12+ # srcOnly returns just the subdir, so we're already in it.
13+ "";
14+
715# This derivation can be used to execute test component.
816# The $out of the derivation is a file containing the resulting
917# stdout output.
@@ -30,8 +38,8 @@ in stdenv.mkDerivation ({
3038 mkdir $out
3139 ${
3240 # Change to the source sub directory if there is one.
33− lib.optionalString (drv.srcSubDir or "" != "") ''
34− cd ${lib.removePrefix "/" drv.srcSubDir}
41+ lib.optionalString (subdir != "") ''
42+ cd ${lib.removePrefix "/" subdir}
3543 ''
3644 }
3745