Skip to content

Commit b17416a

Browse files
committed
docs
1 parent 711de1c commit b17416a

File tree

3 files changed

+601
-118
lines changed

3 files changed

+601
-118
lines changed

CONTRIBUTING.md

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# Contributing to Hypercube
2+
3+
This guide covers the repository structure, build system, and how to make changes to Hypercube.
4+
5+
## Repository Structure
6+
7+
```
8+
hypercube/
9+
├── branding/ # Visual assets
10+
│ ├── hypercube-logo.png # Main logo (200x200)
11+
│ ├── background.png # Desktop background
12+
│ └── animation-*.png # Plymouth boot animation (12 frames)
13+
14+
├── build_files/ # Build scripts
15+
│ ├── shared/
16+
│ │ ├── build.sh # Main orchestrator
17+
│ │ └── clean-stage.sh # Post-build cleanup
18+
│ └── hypercube/
19+
│ ├── 00-hypercube-branding.sh # OS branding & Plymouth
20+
│ ├── 01-hypercube-packages.sh # Package installation
21+
│ ├── 02-hypercube-theming.sh # Tokyo Night theme
22+
│ ├── 03-hypercube-configs.sh # Config file installation
23+
│ └── 99-tests.sh # Build validation
24+
25+
├── dot_files/ # User configurations
26+
│ ├── fish/ # Fish shell config
27+
│ ├── ghostty/ # Ghostty terminal
28+
│ ├── gitui/ # Gitui config
29+
│ ├── gtk-3.0/ # GTK3 settings
30+
│ ├── gtk-4.0/ # GTK4 settings
31+
│ ├── hypr/ # Hyprland configs
32+
│ │ ├── hyprland.conf # Main compositor config
33+
│ │ ├── hyprlock.conf # Lock screen
34+
│ │ ├── hypridle.conf # Idle management
35+
│ │ └── hyprpaper.conf # Wallpaper
36+
│ ├── lazygit/ # Lazygit config
37+
│ ├── nvim/ # Neovim/LazyVim setup
38+
│ ├── qt6ct/ # Qt6 theming
39+
│ ├── quickshell/ # App launcher
40+
│ ├── starship/ # Shell prompt
41+
│ └── wezterm/ # WezTerm terminal
42+
43+
├── system_files/ # System-level files
44+
│ └── shared/
45+
│ ├── usr/
46+
│ │ ├── share/
47+
│ │ │ ├── plymouth/themes/hypercube/ # Boot theme
48+
│ │ │ └── pixmaps/ # System logos
49+
│ │ └── lib/
50+
│ │ ├── bootc/kargs.d/ # Kernel arguments
51+
│ │ └── environment.d/ # Environment variables
52+
│ └── etc/
53+
│ └── dconf/ # System dconf settings
54+
55+
├── .github/workflows/ # CI/CD
56+
│ ├── build.yml # Container build & publish
57+
│ └── build-disk.yml # ISO/disk image generation
58+
59+
├── Containerfile # Container build definition
60+
├── Justfile # Development commands
61+
└── cosign.pub # Image signing key
62+
```
63+
64+
## Build System
65+
66+
### How It Works
67+
68+
1. **Containerfile** defines a multi-stage build:
69+
- Stage 1 (`ctx`): Aggregates build context from `system_files/` and `build_files/`
70+
- Stage 2: Builds on `bluefin-dx:stable-daily` base image
71+
72+
2. **build.sh** orchestrates the build:
73+
- Copies `system_files/` to root filesystem via rsync
74+
- Runs numbered scripts in `build_files/hypercube/` sequentially
75+
- Scripts are named `00-*.sh` through `99-*.sh` for ordering
76+
77+
3. **dot_files/** are copied to `/usr/share/hypercube/config/` and made available via XDG paths
78+
79+
### Build Script Execution Order
80+
81+
| Script | Purpose |
82+
|--------|---------|
83+
| `00-hypercube-branding.sh` | OS release info, Plymouth theme, GDM dconf |
84+
| `01-hypercube-packages.sh` | Package installation via DNF/COPR |
85+
| `02-hypercube-theming.sh` | Tokyo Night GTK/icon theme installation |
86+
| `03-hypercube-configs.sh` | Config file deployment (fish, nvimd, etc.) |
87+
| `99-tests.sh` | Validation tests for required packages/files |
88+
89+
### Configuration Deployment
90+
91+
Configurations follow the XDG Base Directory specification:
92+
93+
- **System defaults**: `/usr/share/hypercube/config/`
94+
- **User overrides**: `~/.config/`
95+
96+
The environment file at `/usr/lib/environment.d/60-hypercube-xdg.conf` adds Hypercube's config directory to `XDG_CONFIG_DIRS`.
97+
98+
## Development Commands
99+
100+
Use [just](https://just.systems/) to run development tasks:
101+
102+
### Building
103+
104+
```bash
105+
just build # Build main variant locally
106+
just build nvidia # Build NVIDIA variant
107+
just build-all # Build both variants
108+
just build-ghcr # Build for GHCR (rootful)
109+
```
110+
111+
### Testing
112+
113+
```bash
114+
just run # Run container interactively
115+
just run nvidia # Run NVIDIA variant
116+
```
117+
118+
### ISO Generation
119+
120+
```bash
121+
just build-iso # Build ISO from local image
122+
just build-iso nvidia # Build NVIDIA ISO
123+
just build-iso-ghcr # Build ISO from GHCR image
124+
just run-iso <file> # Test ISO in QEMU VM
125+
```
126+
127+
### Maintenance
128+
129+
```bash
130+
just clean # Remove build artifacts
131+
just lint # Check shell scripts (shellcheck)
132+
just format # Format shell scripts (shfmt)
133+
just check # Validate Justfile syntax
134+
just fix # Fix Justfile formatting
135+
```
136+
137+
### Verification
138+
139+
```bash
140+
just verify-container hypercube latest # Verify image signature
141+
```
142+
143+
## Making Changes
144+
145+
### Adding Packages
146+
147+
Edit `build_files/hypercube/01-hypercube-packages.sh`:
148+
149+
```bash
150+
# From Fedora repos
151+
dnf5 -y install package-name
152+
153+
# From COPR
154+
dnf5 -y copr enable owner/repo
155+
dnf5 -y install package-name
156+
```
157+
158+
Add to test validation in `99-tests.sh`:
159+
160+
```bash
161+
REQUIRED_PACKAGES=(
162+
# ...
163+
"package-name"
164+
)
165+
```
166+
167+
### Modifying Configurations
168+
169+
1. Edit files in `dot_files/` for user configs
170+
2. Edit files in `system_files/` for system configs
171+
3. Configs are automatically deployed during build
172+
173+
### Adding System Files
174+
175+
Place files in `system_files/shared/` mirroring the target path:
176+
177+
```
178+
system_files/shared/usr/share/foo/bar.conf
179+
→ Deployed to /usr/share/foo/bar.conf
180+
```
181+
182+
### Testing Locally
183+
184+
```bash
185+
# Build the image
186+
just build
187+
188+
# Run interactively to test
189+
just run
190+
191+
# Or build and test ISO
192+
just build-iso
193+
just run-iso hypercube.iso
194+
```
195+
196+
## Forking Hypercube
197+
198+
To create your own variant:
199+
200+
1. **Fork** the repository on GitHub
201+
202+
2. **Update branding**:
203+
- Edit `build_files/hypercube/00-hypercube-branding.sh`
204+
- Replace images in `branding/`
205+
- Update `artifacthub-repo.yml`
206+
207+
3. **Customize packages** in `01-hypercube-packages.sh`
208+
209+
4. **Modify configs** in `dot_files/` and `system_files/`
210+
211+
5. **Enable GitHub Actions**:
212+
- Go to Settings → Actions → General
213+
- Enable "Read and write permissions"
214+
- The workflow will build and publish to your GHCR
215+
216+
6. **Your image** will be available at:
217+
```
218+
ghcr.io/<your-username>/<your-repo>:latest
219+
```
220+
221+
## Code Style
222+
223+
- Shell scripts: Follow [shellcheck](https://www.shellcheck.net/) recommendations
224+
- Use `shfmt` for consistent formatting
225+
- Keep scripts focused and well-commented
226+
- Test changes locally before pushing
227+
228+
## Pull Requests
229+
230+
1. Fork the repository
231+
2. Create a feature branch
232+
3. Make your changes
233+
4. Test locally with `just build && just run`
234+
5. Run `just lint` to check for issues
235+
6. Submit a pull request
236+
237+
## Questions?
238+
239+
- [Open an issue](https://github.com/binarypie-dev/hypercube/issues) for bugs or features
240+
- [Universal Blue Discord](https://discord.gg/WEu6BdFEtp) for community help

0 commit comments

Comments
 (0)