Remove the CMake patching workaround

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-07-05 03:24:37 +03:00
parent 2e38196ea5
commit 21c8c60369
2 changed files with 4 additions and 41 deletions

View File

@@ -26,10 +26,6 @@
hardeningDisable = [ "fortify" ];
packages = with pkgs; [
(pkgs.callPackage ./nix/cmake-importstd-patched/package.nix {
libcxx = pkgs.llvmPackages_20.libcxx;
})
pkg-config
cmake
ninja
@@ -63,6 +59,10 @@
xorg.libXau
xorg.libXdmcp
];
shellHook = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${pkgs.llvmPackages_20.libcxx}/lib -I${pkgs.llvmPackages_20.libcxx.dev}/include/c++/v1"
'';
};
}
);

View File

@@ -1,37 +0,0 @@
# Dummy cmake package for replacing the ImportStd module.
# Symlink existing derivation to avoid rebuilding package from source.
# I.e. rather than using overlay or override(Attr) to add patch.
#
# Note this is actually a clang/llvm issue (`-print-file-name` flag not working),
# but it is much simpler to just patch the cmake module itself. Maybe fixed in llvm 19.1.7
#
# See relevant issues:
# 1. https://github.com/NixOS/nixpkgs/issues/370217
# 2. https://gitlab.kitware.com/cmake/cmake/-/issues/25965#note_1523575
{
lib,
cmake,
libcxx,
symlinkJoin,
}:
let
cmake-ver = "${lib.versions.majorMinor cmake.version}";
module-path = "share/cmake-${cmake-ver}/Modules/Compiler/Clang-CXX-CXXImportStd.cmake";
in
symlinkJoin {
name = "${cmake.name}-importstd-module-patched";
paths = [ cmake ];
postBuild = ''
# copy binaries to avoid using original derivation
for link in $(find $out/bin/ -type l); do
cp --remove-destination $(readlink $link) $out/bin/
done;
# replace symlink to existing module with copy for editing
cp --remove-destination $(readlink $out/${module-path}) $out/${module-path}
# replace "libc++.modules.json" with full path
# to libc++ module json in new copied module file
sed -i 's#libc++.modules.json#${libcxx}/lib/libc++.modules.json#' $out/${module-path}
'';
}