Skip to content

Commit 856d83a

Browse files
committed
sphinx: fix sphinx setup-hook for direnv
nix develop is fine, but direnv does not like it it $cmakeFlags is empty due to stricter shell evaluation mode. This seems to fix it.
1 parent 413230e commit 856d83a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

pkgs/sphinx-cmake.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ stdenv.mkDerivation {
2929
'';
3030

3131
postFixup = ''
32-
mkdir -p $out/nix-support
33-
cat > $out/nix-support/setup-hook <<EOF
34-
add_sphinx_to_cmake_flags() {
35-
# This appends the module path to the actual flags passed to the cmake command
36-
export cmakeFlags="\$cmakeFlags -DCMAKE_MODULE_PATH=$out/lib/cmake/sphinx-cmake"
37-
}
38-
addEnvHooks "\$hostOffset" add_sphinx_to_cmake_flags
32+
mkdir -p $out/nix-support
33+
cat > $out/nix-support/setup-hook <<EOF
34+
add_sphinx_to_cmake_flags() {
35+
# Use \''${cmakeFlags:-} to avoid "unbound variable" errors
36+
export cmakeFlags="\''${cmakeFlags:-} -DCMAKE_MODULE_PATH=$out/lib/cmake/sphinx-cmake"
37+
}
38+
addEnvHooks "\$hostOffset" add_sphinx_to_cmake_flags
3939
EOF
4040
'';
4141
}

0 commit comments

Comments
 (0)