GhostBridge完成NixOS配置
GhostBridge基础设施系统的生产就绪NixOS配置,具有以下特点:
- 鬼桥:具有OVS网桥网络隔离的隐私路由器
- 不可变审计跟踪:基于区块链的日志记录与矢量数据库集成
- MCP D-Bus编排器:基于人工智能的Linux系统管理
建筑
网络(OVS网桥)
- 奥夫斯堡:连接到物理NIC的面向互联网的网桥(ens1)
- 奥夫斯堡1:内部网桥(10.0.1.0/24)
- 禁用硬件卸载以防止DPU数据包问题
存储(BTRFS)
- @:根文件系统(zstd:3压缩)
- @家:用户主目录
- @覆盖层:来自以前系统的140GB整合备份
- @区块链计时:不可变区块链事件存储(zstd:9)
- @区块链向量:Qdrant矢量数据库存储
- @工作:高性能临时工作空间(nodatacow)
服务
- btrfs快照:每1秒创建一次只读快照
- btrfs矢量同步:每1秒将区块链事件同步到Qdrant
- 矢量点:用于基础设施事件语义搜索的矢量数据库
- op-dbus 的:D-Bus编排守护进程
- dbus-mcp服务器:MCP服务器公开D-Bus API
- dbus-mcp网站:端口8096上的Web界面
虚拟化
- KVM/QEMU:通过OVS网桥集成支持虚拟机
- LXC/LXD:容器运行时
- 码头工人:集装箱平台
- NoVNC:端口6080上的Web控制台
文件结构
nix/ghostbridge/
├── flake.nix # Flake entry point
├── configuration.nix # Main system configuration
├── hardware-configuration.nix # Hardware detection template
├── modules/
│ ├── ghostbridge-ovs.nix # OVS network setup
│ ├── blockchain-storage.nix # BTRFS + blockchain + Qdrant
│ ├── dbus-orchestrator.nix # D-Bus services
│ ├── virtualization.nix # KVM/LXC/Docker
│ └── scripts/
│ ├── btrfs-snapshot.sh # Snapshot orchestrator
│ └── btrfs-vector-sync.sh # Qdrant sync
├── README.md # This file
└── INSTALL.md # Installation guide快速开始
1.分区驱动器
# Create EFI boot partition (512MB)
gdisk /dev/nvme1n1
# n, 1, default, +512M, ef00
# Create main BTRFS partition (remainder)
# n, 2, default, default, 8300
# Write changes: w2.格式化和创建BTRFS子卷
# Format EFI partition
mkfs.vfat -F32 -n BOOT /dev/nvme1n1p1
# Format BTRFS partition
mkfs.btrfs -L nixos /dev/nvme1n1p2
# Mount and create subvolumes
mount /dev/nvme1n1p2 /mnt
cd /mnt
btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @overlay
btrfs subvolume create @blockchain-timing
btrfs subvolume create @blockchain-vectors
btrfs subvolume create @work
cd /
umount /mnt3.安装子卷
# Mount root
mount -o subvol=@,compress=zstd:3,noatime,space_cache=v2,ssd /dev/nvme1n1p2 /mnt
# Create mount points
mkdir -p /mnt/{home,overlay,boot,var/lib/blockchain-timing,var/lib/blockchain-vectors,work}
# Mount other subvolumes
mount -o subvol=@home,compress=zstd:3,noatime,space_cache=v2,ssd /dev/nvme1n1p2 /mnt/home
mount -o subvol=@overlay,compress=zstd:3,noatime,space_cache=v2,ssd /dev/nvme1n1p2 /mnt/overlay
mount -o subvol=@blockchain-timing,compress=zstd:9,noatime,space_cache=v2 /dev/nvme1n1p2 /mnt/var/lib/blockchain-timing
mount -o subvol=@blockchain-vectors,compress=zstd:3,noatime,space_cache=v2 /dev/nvme1n1p2 /mnt/var/lib/blockchain-vectors
mount -o subvol=@work,noatime,nodatacow,space_cache=v2,ssd /dev/nvme1n1p2 /mnt/work
# Mount boot
mount /dev/nvme1n1p1 /mnt/boot4.复制配置文件
# Copy all files to /mnt/etc/nixos/
mkdir -p /mnt/etc/nixos/modules/scripts
cp -r nix/ghostbridge/* /mnt/etc/nixos/
# Make scripts executable
chmod +x /mnt/etc/nixos/modules/scripts/*.sh5.安装nixos
# Install with flakes
nixos-install --flake /mnt/etc/nixos#ghostbridge
# Set root password when prompted
# Reboot
reboot6.安装后
# After reboot, verify OVS bridges
/etc/ghostbridge/ovs-status.sh
# Check D-Bus services
/etc/ghostbridge/test-dbus.sh
# Query blockchain events
/etc/ghostbridge/query-blockchain.sh
# Build op-dbus binaries
cd /path/to/operation-dbus
cargo build --release --all-features
# Install binaries
sudo cp target/release/op-dbus /usr/local/bin/
sudo cp target/release/dbus-mcp /usr/local/bin/
sudo cp target/release/dbus-mcp-web /usr/local/bin/
# Restart services
sudo systemctl restart op-dbus dbus-mcp-server dbus-mcp-web配置更新
# Edit configuration
sudo vim /etc/nixos/configuration.nix
# Test configuration (doesn't activate)
sudo nixos-rebuild test --flake /etc/nixos#ghostbridge
# Build and activate
sudo nixos-rebuild switch --flake /etc/nixos#ghostbridge
# Or build for next boot
sudo nixos-rebuild boot --flake /etc/nixos#ghostbridge监控
- 普罗米修斯: http://localhost:9090
- 格拉法纳: http://localhost:3000
- NoVNC控制台: http://localhost:6080
- MCP Web用户界面: http://localhost:8096
- Qdrant: http://localhost:6333/dashboard
故障排除
OVS桥梁未建成
# Check OVS service
sudo systemctl status openvswitch.service
sudo systemctl status ovs-bridge-setup.service
# Manually recreate bridges
sudo systemctl restart ovs-bridge-setup.serviceBTRFS快照不起作用
# Check snapshot service
sudo systemctl status btrfs-snapshot.service
sudo journalctl -u btrfs-snapshot.service -f
# Check disk space
sudo btrfs filesystem usage /var/lib/blockchain-timingD-Bus服务失败
# Check service status
sudo systemctl status op-dbus.service
sudo systemctl status dbus-mcp-server.service
# Check D-Bus configuration
busctl list | grep opdbus
# Test D-Bus introspection
busctl introspect org.freedesktop.opdbus /org/freedesktop/opdbus关键成功因素
✅ OVS桥接器在启动时干净整洁\ ✅ 没有格式错误的DPU数据包(硬件卸载已禁用)\ ✅ BTRFS快照每1秒运行一次,没有累积\ ✅ Qdrant通过BTRFS发送/接收每秒同步一次\ ✅ D-Bus API可用于编排\ ✅ VM/容器可以连接到OVS网桥\ ✅ 使用systemd引导(非GRUB)启动\ ✅ 使用Ed25519 SSH密钥(不是DSA)\ ✅ systemd-networkd(不是NetworkManager)\ ✅ .nix文件中的所有配置声明
许可证
有关许可证信息,请参阅父存储库。
