Skip to content

Commit 5dc3298

Browse files
Jesssullivanclaude
andcommitted
add nix flake and multi-stage container support
- Add flake.nix with LLVM 21 support (bundled LLVM default) - chapel: bundled LLVM for LLVM 14-21 support - chapel-system-llvm: system LLVM 19 from nixpkgs - chapel-gnu: GNU backend only (no LLVM) - chpl-language-server: standalone LSP package - Development shells with proper LLVM environment - Add Containerfile.multi-stage with LLVM 21 default - 6-stage build for modular deployment - Auto-adds LLVM.org apt repo for versions >= 20 - Targets: chapel-full, chapel-lsp, chapel-runtime, chapel-gasnet - Add .github/workflows/nix.yml for Nix CI - Flake check, GNU build, system LLVM build, dev shell test - Update prereqs.rst to document LLVM 21 support Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 755a701 commit 5dc3298

File tree

5 files changed

+842
-1
lines changed

5 files changed

+842
-1
lines changed

.github/workflows/nix.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Nix Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'flake.nix'
8+
- 'flake.lock'
9+
- 'compiler/**'
10+
- 'runtime/**'
11+
- 'modules/**'
12+
- 'tools/**'
13+
- 'util/**'
14+
- 'make/**'
15+
- 'Makefile*'
16+
pull_request:
17+
paths:
18+
- 'flake.nix'
19+
- 'flake.lock'
20+
- 'compiler/**'
21+
- 'runtime/**'
22+
- 'modules/**'
23+
- 'tools/**'
24+
- 'util/**'
25+
- 'make/**'
26+
- 'Makefile*'
27+
workflow_dispatch:
28+
29+
jobs:
30+
flake-check:
31+
name: Nix Flake Check
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Install Nix
37+
uses: cachix/install-nix-action@v27
38+
with:
39+
nix_path: nixpkgs=channel:nixos-unstable
40+
extra_nix_config: |
41+
experimental-features = nix-command flakes
42+
43+
- name: Check flake
44+
run: nix flake check --no-build
45+
46+
- name: Show flake info
47+
run: nix flake show
48+
49+
build-chapel-gnu:
50+
name: Build Chapel (GNU backend)
51+
runs-on: ubuntu-latest
52+
needs: flake-check
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Install Nix
57+
uses: cachix/install-nix-action@v27
58+
with:
59+
nix_path: nixpkgs=channel:nixos-unstable
60+
extra_nix_config: |
61+
experimental-features = nix-command flakes
62+
63+
- name: Build chapel-gnu
64+
run: |
65+
nix build .#chapel-gnu --print-build-logs
66+
./result/bin/chpl --version
67+
68+
build-chapel-bundled-llvm:
69+
name: Build Chapel (Bundled LLVM - supports LLVM 21)
70+
runs-on: ubuntu-latest
71+
needs: flake-check
72+
# This is a long build (~4GB memory), only run on main or when explicitly requested
73+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
74+
steps:
75+
- uses: actions/checkout@v4
76+
77+
- name: Install Nix
78+
uses: cachix/install-nix-action@v27
79+
with:
80+
nix_path: nixpkgs=channel:nixos-unstable
81+
extra_nix_config: |
82+
experimental-features = nix-command flakes
83+
84+
- name: Build chapel (bundled LLVM)
85+
run: |
86+
nix build .#chapel --print-build-logs
87+
./result/bin/chpl --version
88+
89+
build-chapel-system-llvm:
90+
name: Build Chapel (System LLVM 19)
91+
runs-on: ubuntu-latest
92+
needs: flake-check
93+
steps:
94+
- uses: actions/checkout@v4
95+
96+
- name: Install Nix
97+
uses: cachix/install-nix-action@v27
98+
with:
99+
nix_path: nixpkgs=channel:nixos-unstable
100+
extra_nix_config: |
101+
experimental-features = nix-command flakes
102+
103+
- name: Build chapel-system-llvm
104+
run: |
105+
nix build .#chapel-system-llvm --print-build-logs
106+
./result/bin/chpl --version
107+
108+
dev-shell:
109+
name: Test Dev Shell
110+
runs-on: ubuntu-latest
111+
needs: flake-check
112+
steps:
113+
- uses: actions/checkout@v4
114+
115+
- name: Install Nix
116+
uses: cachix/install-nix-action@v27
117+
with:
118+
nix_path: nixpkgs=channel:nixos-unstable
119+
extra_nix_config: |
120+
experimental-features = nix-command flakes
121+
122+
- name: Test chapel-dev shell
123+
run: |
124+
nix develop .#chapel-dev --command bash -c '
125+
echo "Testing chapel-dev shell..."
126+
echo "CHPL_LLVM=$CHPL_LLVM"
127+
echo "CHPL_LLVM_CONFIG=$CHPL_LLVM_CONFIG"
128+
which clang
129+
llvm-config --version
130+
'

0 commit comments

Comments
 (0)