-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
90 lines (75 loc) · 3.18 KB
/
Copy pathflake.nix
File metadata and controls
90 lines (75 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
description = "AFMBridge - Development tools wrapping system Swift";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = false;
};
};
# Python with SDK packages for integration testing
pythonWithPackages = pkgs.python3.withPackages (ps: [
ps.openai
ps.anthropic
]);
in
{
# Development shell - wraps system Swift, provides dev tools
# Uses mkShellNoCC to avoid Nix's C compiler wrapper and SDK
devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [
# Task runner (pure Rust, no SDK dependencies)
just
# Markdown linting (pure Node.js, no SDK dependencies)
nodePackages.markdownlint-cli2
# Python SDK packages for integration tests
pythonWithPackages
# Note: Removed git, direnv - these pull in clang/SDK
# Install via Homebrew instead: brew install git direnv
];
shellHook = ''
# Force system toolchain paths (critical for Swift)
export SDKROOT=$(xcrun --show-sdk-path 2>/dev/null || echo "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
export DEVELOPER_DIR=$(xcode-select -p 2>/dev/null || echo "/Applications/Xcode.app/Contents/Developer")
# Clear any Nix compiler variables
unset NIX_CFLAGS_COMPILE NIX_LDFLAGS NIX_CC NIX_BINTOOLS
# Ensure system tools come first
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
# Add Homebrew (for swift-format, swiftlint, git, direnv)
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
# Set PYTHONPATH for SDK integration tests
export PYTHONPATH="${pythonWithPackages}/${pythonWithPackages.sitePackages}:$PYTHONPATH"
# Server defaults
export HOST="127.0.0.1"
export PORT="8080"
echo "🚀 AFMBridge Development Environment"
echo ""
echo "Tools provided by Nix:"
echo " ✓ just Task runner"
echo " ✓ markdownlint-cli2 Markdown linting"
echo " ✓ python3 SDK integration tests (openai, anthropic)"
echo ""
echo "Tools from Homebrew (install if missing):"
echo " brew install swift-format swiftlint git direnv"
echo ""
echo "Swift (system toolchain):"
swift --version 2>/dev/null || echo " ⚠ Swift not found - install Xcode"
echo " SDK: $SDKROOT"
echo ""
echo "Commands:"
echo " just --list Show all tasks"
echo " just validate Run all quality checks"
echo " just run Start the server"
'';
};
# Formatter for Nix files
formatter = pkgs.nixpkgs-fmt;
}
);
}