Bad substitution on nix-shell for clang-format

Hi,

I am using a nix-shell file to create a working directory for a C++ project. Whenever I use clang-format in the shell with some added libs, ie. nix-shell -p clang-tools libGL I get the following error:

[nix-shell:/tmp/tmp.GUs295laXm]$ clang-format --version
/nix/store/732k81zm5rr7p98sy2hln710d1q3x2xa-clang-tools-8.0.1/bin/clang-format: line 9: $path${path':'}$1: bad substitution
clang-format version 8.0.1 (tags/RELEASE_801/final)

When I only use clang-tools without any libs, ie nix-shell -p clang-tools, it works fine

[nix-shell:/tmp/tmp.GUs295laXm]$ clang-format --version
clang-format version 8.0.1 (tags/RELEASE_801/final)

I am on NixOS 19.09. Originally I ran into this problem when using lorri + direnv, but this is the minimal example to reproduce it.

This was fixed on master here clang-tools: fix substitution in wrapper · NixOS/nixpkgs@1caddbe · GitHub but it looks like it wasn’t backported.

Also now in 19.09: clang-tools: fix substitution in wrapper · NixOS/nixpkgs@fd3068b · GitHub

2 Likes

Thanks for the quick action!

Does it take some time to arrive? I’ve updated my system with sudo nixos-rebuild switch --upgrade and nix-env -u, but I still see the error message.

The last update of the 19.09 channel was two days ago:

https://howoldis.herokuapp.com

It got updated now. Thanks again everyone