Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/debug-glibc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Debug nix develop environment

on:
workflow_dispatch:

jobs:
debug-nix:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v24

- name: Enter nix develop shell
run: |
nix develop --command bash -c '
echo "🔧 Nix develop shell entered"

echo
echo "🔍 Checking for stdlib.h"
find /nix/store -name "stdlib.h" || echo "❌ stdlib.h not found"

echo
echo "📂 Checking expected glibc include path"
ls -l /nix/store/*glibc*/include/stdlib.h || echo "❌ /glibc*/include/stdlib.h not found"

echo
echo "🧠 C compiler version and paths:"
gcc --version
echo

echo "📤 GCC include paths:"
echo | gcc -E -x c -v -

echo
echo "📤 g++ include paths:"
echo | g++ -E -x c++ -v -

echo
echo "✅ Diagnostic complete"
'
28 changes: 17 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,41 @@ name: "test"

on:
push:
branches: [ main, develop ]
branches: [main, develop]
pull_request:
branches: [ main, develop ]
branches: [main, develop]

jobs:
testbuild:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

# 🔴 REQUIRED: minimal system bootstrap so bindgen/libclang can start

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libclang-14-dev libstdc++6 clang

- name: Install nix
sudo apt-get install -y \
libclang-dev \
libstdc++6 \
clang \
cmake \
pkg-config

- name: Install Nix
uses: cachix/install-nix-action@v27
with:
install_url: https://releases.nixos.org/nix/nix-2.23.3/install
extra_nix_config: |
experimental-features = flakes nix-command
experimental-features = nix-command flakes

- uses: cachix/cachix-action@v15
with:
name: holochain-ci

- name: Install and test
run: |
nix develop --command bash -c "npm i && npm t"
export LIBCLANG_PATH=$(nix eval --raw .#devShells.x86_64-linux.default.buildInputs | grep libclang | head -1)/lib
export LD_LIBRARY_PATH=$(nix eval --raw .#devShells.x86_64-linux.default.buildInputs | grep llvm | head -1)/lib:$LD_LIBRARY_PATH
export NIX_CFLAGS_COMPILE="-isystem $(nix eval --raw .#devShells.x86_64-linux.default.buildInputs | grep glibc | grep dev | head -1)/include"
export NIX_LDFLAGS="-L$(nix eval --raw .#devShells.x86_64-linux.default.buildInputs | grep glibc | grep -v dev | head -1)/lib"
nix develop --command bash -c "npm install && npm test"
3 changes: 2 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,5 @@ If you’re unsure where code belongs, ask:

If the answer is **no**, it does not belong in `shared/` or `happ/`.

That single heuristic will prevent most architectural violations.
That single heuristic will prevent most architectural violations.

35 changes: 20 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,38 @@
# Pull in holonix dev shell
inputsFrom = [ inputs'.holonix.devShells.default ];

# Extra native tools (incl. libclang + libstdc++ for CI)
nativeBuildInputs = [
pkgs.libsodium
pkgs.pkg-config
pkgs.llvmPackages.libunwind
pkgs.llvmPackages.libclang # ✅ Required by bindgen
pkgs.llvmPackages.clang-unwrapped # ✅ Needed to satisfy some crates
pkgs.stdenv.cc.cc.lib # ✅ Pulls in libstdc++.so
pkgs.cmake
];

packages = with pkgs; [
# ✅ Native build toolchain + headers required on CI (Ubuntu)
stdenv.cc
glibc.dev

# ✅ For crates like bindgen / cmake / datachannel-sys
llvmPackages.libclang
llvmPackages.clang-unwrapped
llvmPackages.libunwind
pkg-config
cmake
libsodium

# App-specific tools
nodejs_22
binaryen
];

shellHook =
''
export PS1='$begin:math:display$\\033\[1\;34m$end:math:display$[holonix:\w]\$$begin:math:display$\\033\[0m$end:math:display$ '
export PS1='\[\033[1;34m\][holonix:\w]\$\[\033[0m\] '

# Cross-platform: modern CMake policy + reduce configure flakiness
# 🛠 For CMake-based crates and general safety
export CMAKE_ARGS="''${CMAKE_ARGS:-} -DCMAKE_POLICY_VERSION_MINIMUM=3.10"
export CMAKE_BUILD_PARALLEL_LEVEL="''${CMAKE_BUILD_PARALLEL_LEVEL:-1}"

# ✅ Critical for CI (Ubuntu) to find stdlib headers + libs
export NIX_CFLAGS_COMPILE="-isystem ${pkgs.glibc.dev}/include"
export NIX_LDFLAGS="-L${pkgs.glibc}/lib -L${pkgs.stdenv.cc.cc.lib}/lib"
''
# macOS-only: use Apple's toolchain for native deps
+ pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
# Requires Xcode CLT: xcode-select --install
# macOS-only: use Apple's toolchain
export CC="$(xcrun -f clang)"
export CXX="$(xcrun -f clang++)"
export AR="$(xcrun -f ar)"
Expand Down
Loading