π Flake Configuration Guide
π¦ Two Flake Configurationsβ
This project provides two flake configurations:
-
flake.nix- Production (GitHub URIs)- Uses
github:marcosfpina/*for all components - Best for: CI/CD, reproducible builds, public usage
- Fetches from GitHub on each update
- Uses
-
flake.development.nix- Local Development (Path URIs)- Uses
path:../componentfor all components - Best for: Local development, testing changes before pushing
- Uses local filesystem (instant updates)
- Uses
π― When to Use Eachβ
Use flake.nix (GitHub URIs) when:β
- β Running CI/CD pipelines
- β Building for production
- β Sharing with other developers
- β Want reproducible builds
- β Testing published versions
Use flake.development.nix (Local Paths) when:β
- π§ Developing components locally
- π§ Testing changes before commit
- π§ Working on multiple repos simultaneously
- π§ Need instant feedback (no git push required)
π Switching Between Configurationsβ
Method 1: Rename Files (Recommended)β
# Switch to local development
mv flake.nix flake.github.nix
mv flake.development.nix flake.nix
nix develop
# Switch back to GitHub version
mv flake.nix flake.development.nix
mv flake.github.nix flake.nix
nix develop
Method 2: Use --override-input (No file changes)β
# Override specific component to use local path
nix develop --override-input neoland path:../neoland
# Override all components at once
nix develop \
--override-input neoland path:../neoland \
--override-input phantom path:../phantom \
--override-input neutron path:../neutron \
--override-input cerebro path:../cerebro \
--override-input spectre path:../spectre \
--override-input adr-ledger path:../adr-ledger
Method 3: Git Branch Strategyβ
# Create a local development branch
git checkout -b local-dev
# Edit flake.nix to use local paths
sed -i 's|github:marcosfpina/|path:../|g' flake.nix
# Use this branch for development
nix develop
# Keep main branch with GitHub URIs
git checkout main
nix develop # Uses GitHub URIs
π GitHub URI Configuration (Current)β
File: flake.nix
inputs = {
neoland.url = "github:marcosfpina/neoland";
phantom.url = "github:marcosfpina/phantom";
neutron.url = "github:marcosfpina/neutron";
cerebro.url = "github:marcosfpina/cerebro";
spectre.url = "github:marcosfpina/spectre";
adr-ledger.url = "github:marcosfpina/adr-ledger";
};
Advantages:
- β Reproducible across machines
- β Works in CI/CD without setup
- β Cacheable by Nix binary cache
- β Version pinned via flake.lock
- β Easy to share
Disadvantages:
- β Requires
git pushto test changes - β Slower iteration cycle
- β Needs internet connection
π§ Local Path Configuration (Alternative)β
File: flake.development.nix
inputs = {
neoland.url = "path:../neoland";
phantom.url = "path:../phantom";
neutron.url = "path:../neutron";
cerebro.url = "path:../cerebro";
spectre.url = "path:../spectre";
adr-ledger.url = "path:../adr-ledger";
};
Advantages:
- β Instant updates (no git push needed)
- β Fast iteration cycle
- β Works offline
- β Test uncommitted changes
Disadvantages:
- β Not reproducible on other machines
- β Requires local repository structure
- β Won't work in CI/CD without modification
π Expected Directory Structureβ
For local development mode to work, your directory structure should be:
~/arch/
βββ integration-tests/ # This repository
βββ neoland/
βββ phantom/
βββ neutron/
βββ cerebro/
βββ spectre/
βββ adr-ledger/
π― Recommended Workflowβ
For Developmentβ
# 1. Clone all repositories
cd ~/arch
git clone https://github.com/marcosfpina/integration-tests
git clone https://github.com/marcosfpina/neoland
git clone https://github.com/marcosfpina/phantom
# ... etc
# 2. Switch to local development mode
cd integration-tests
mv flake.nix flake.github.nix
mv flake.development.nix flake.nix
# 3. Develop with instant feedback
nix develop
# Edit ../neoland/src/...
# Changes reflect immediately!
# 4. Before committing, test with GitHub URIs
mv flake.nix flake.development.nix
mv flake.github.nix flake.nix
nix flake update # Update to latest GitHub versions
nix develop # Test with published versions
For CI/CDβ
# GitHub Actions
- name: Run integration tests
run: |
# Always uses flake.nix (GitHub URIs)
nix run .#test
For Public Usageβ
# Users can directly use GitHub version
nix develop github:marcosfpina/integration-tests
# Or clone and use
git clone https://github.com/marcosfpina/integration-tests
cd integration-tests
nix develop # Uses GitHub URIs by default
π Verificationβ
Check Current Configurationβ
# Show which inputs are being used
nix flake metadata
# Show detailed input sources
nix flake metadata --json | jq '.locks.nodes'
# Check if using local or GitHub
grep -E "url.*github:|path:" flake.nix
Test Both Configurationsβ
# Test GitHub version
nix develop --override-input neoland github:marcosfpina/neoland
pytest --version
# Test local version
nix develop --override-input neoland path:../neoland
pytest --version
π Comparison Tableβ
| Feature | GitHub URIs | Local Paths |
|---|---|---|
| Reproducibility | β Perfect | β Machine-dependent |
| Iteration Speed | β Slow (needs push) | β Instant |
| CI/CD Ready | β Yes | β Requires setup |
| Offline Work | β Needs internet | β Fully offline |
| Share with Team | β Easy | β Complex |
| Binary Cache | β Cacheable | β Not cacheable |
| Version Control | β Via flake.lock | β Manual |
π‘ Pro Tipsβ
-
Keep Both Versions in Sync
# Use a script to ensure both flakes have same outputsdiff -u flake.nix flake.development.nix -
Use Git Ignore for Local Flake
# Add to .gitignore if you don't want to commit local versionflake.development.nix -
Automate Switching with Scripts
# Create helpersecho 'alias nix-local="mv flake.nix flake.github.nix && mv flake.development.nix flake.nix"' >> ~/.bashrcecho 'alias nix-github="mv flake.nix flake.development.nix && mv flake.github.nix flake.nix"' >> ~/.bashrc -
Use Direnv with Conditional Loading
# .envrcif [ -f flake.development.nix ]; thenecho "Using local development flake"fiuse flake
π― Best Practicesβ
- β
Default to GitHub URIs (in
flake.nix) - β Keep local version private (don't commit to public repo)
- β Document structure in README
- β Test both versions before release
- β Update flake.lock regularly
Current Configuration: π GitHub URIs (Production)
To switch to local development: See "Method 1" above