Change:
Describe the bug The ldc package (1.17.0) is currently failing to build properly in the unstable branch. It looks like the following is the culprit: To Reproduce Steps to reproduce the behavior: done! Expected behavior The package should build and install cleanly. Metadata system: host os: multi-user?: sandbox: version: channels(root): channels(chrisaw): nixpkgs: cc
Right, looks like is commit introducing the failure. The relied on shell expansion which no longer happens, so we get this: Instead of this:
cc
is right. So a fix could be to use but I find the hardcoded /build quite ugly. The path doesn't need to be in /build but I put it there to make sure it's not a file used by some other process. Switching from /build to /tmp or whatever is for this reason not a good solution.
I'm not sure with the changes for structured attrs we could use shell expansion for like before. Perhaps could comment since the fix looks obvious.
Right CMake does not interpolate environment variable, this was oversight on our part. Looks like was in and I agree that hardcoding is not a good idea but the presence of feels like a hack too. What is ts purpose? If the string imports are generated by the build system, I would expect them to be found without any extra flags. And if they are generated us during bootstrapping, I would expect them to be in a separate derivation, making referencing them work without variable interpolation. If we cannot get rid of the , we should move the flag to until we can.
Looks like the flag is needed for Could we copy the file to a build system’s natural directory like or something, so that the flag could be omitted?
The flag is the only possibility to get the tzdata path into the library. See for the code in the library. Where the file is doesn't matter but I don't see any better location as $PWD for now.
Is not it possible to put it to directory or something?
Yes but I still need to get the full path to it for -J and there is no default directory so you could omit the -J if you mean that. See point 3 in .

Discussion:
{ stdenv, fetchurl, cmake, ninja, llvm_5, llvm_8, curl, tzdata , python, libconfig, lit, gdb, unzip, darwin, bash <del> , callPackage, makeWrapper, targetPackages </del> <ins> , callPackage, makeWrapper, runCommand, targetPackages </ins> , bootstrapVersion ? false , version ? "1.17.0" , ldcSha256 ? "1aag5jfrng6p4ms0fs90hjbv9bcj3hj8h52r68c3cm6racdajbva"

else ""; <ins> pathConfig = runCommand "ldc-lib-paths" {} '' mkdir $out echo ${tzdata}/share/zoneinfo/ > $out/TZDatabaseDirFile echo ${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} > $out/LibcurlPathFile ''; </ins> in stdenv.mkDerivation rec {

rm ldc-${version}-src/tests/d2/dmd-testsuite/fail_compilation/mixin_gc.d rm ldc-${version}-src/tests/d2/dmd-testsuite/runnable/xtest46_gc.d rm ldc-${version}-src/tests/d2/dmd-testsuite/runnable/testptrref_gc.d <ins> # test depends on current year rm ldc-${version}-src/tests/d2/dmd-testsuite/compilable/ddocYear.d </ins> '' + stdenv.lib.optionalString (!bootstrapVersion && stdenv.hostPlatform.isDarwin) '' # https://github.com/NixOS/nixpkgs/issues/34817 rm -r ldc-${version}-src/tests/plugins/addFuncEntryCall <del> '' + stdenv.lib.optionalString (!bootstrapVersion) '' echo ${tzdata}/share/zoneinfo/ > ldc-${version}-src/TZDatabaseDirFile echo ${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} > ldc-${version}-src/LibcurlPathFile </del> ''; postPatch = ''

buildInputs = [ curl tzdata ]; cmakeFlags = stdenv.lib.optionals (!bootstrapVersion) [ <del> "-DD_FLAGS=-d-version=TZDatabaseDir;-d-version=LibcurlPath;-J$PWD" </del> <ins> "-DD_FLAGS=-d-version=TZDatabaseDir;-d-version=LibcurlPath;-J${pathConfig}" </ins> "-DCMAKE_BUILD_TYPE=Release" ];