fix nix hooks & patch phase

This commit is contained in:
Book-reader
2025-10-15 23:42:37 +13:00
committed by Christoffer Lerno
parent 7b649314ec
commit 5ed1281451

View File

@@ -9,13 +9,13 @@
rev,
debug ? false,
checks ? false,
}: let
}: let
inherit (builtins) readFile elemAt;
# inherit (lib.sources) cleanSourceWith cleanSource;
inherit (lib.lists) findFirst;
inherit (lib.asserts) assertMsg;
inherit (lib.strings) hasInfix splitString removeSuffix removePrefix optionalString;
in llvmPackages.stdenv.mkDerivation (_:
in llvmPackages.stdenv.mkDerivation (_:
{
pname = "c3c${optionalString debug "-debug"}";
@@ -33,7 +33,7 @@ in llvmPackages.stdenv.mkDerivation (_:
# Here we substitute GIT_HASH which is not set for cmake in nix builds.
# Similar situation is with __DATE__ and __TIME__ macros, which are
# set to "Jan 01 1980 00:00:00" by default.
patchPhase = ''
postPatch = ''
substituteInPlace git_hash.cmake --replace-fail "\''${GIT_HASH}" "${rev}"
local FILE_NAMES="$(find src -type f)"
@@ -49,8 +49,8 @@ in llvmPackages.stdenv.mkDerivation (_:
"-DLLVM_CRT_LIBRARY_DIR=${llvmPackages.compiler-rt}/lib/darwin"
];
nativeBuildInputs = [
cmake
nativeBuildInputs = [
cmake
llvmPackages.llvm
llvmPackages.lld
llvmPackages.compiler-rt
@@ -71,6 +71,7 @@ in llvmPackages.stdenv.mkDerivation (_:
# In check phase we preserve BUILD directory as
# we need to return to it before install phase
checkPhase = ''
runHook preCheck
local BUILD_DIR=$(pwd)
cd ../resources/testproject
@@ -80,6 +81,7 @@ in llvmPackages.stdenv.mkDerivation (_:
../build/c3c compile-run -O1 src/test_suite_runner.c3 -- ../build/c3c ./test_suite
cd $BUILD_DIR
runHook postCheck
'';
meta = with lib; {