Dancer is the declarative package manager for Compass Linux. It handles package resolution, building, conflict solving, and incremental updates. Everything is configured in Haskell.
- Declarative package definitions: Write packages in Haskell with full type safety.
- Dependency resolution: Automatically resolves and fetches transitive dependencies.
- Conflict detection: Warns about incompatible package combinations (e.g., GNU tools + musl libc).
- Incremental builds: Only rebuild packages that have changed.
- Full rebuilds: Cold rebuild the entire system with --from-scratch.
- Generations: Automatically creates snapshots for easy rollback.
- USE flags: Fine-grained control over package features.
- Build environment: Respects MAKEFLAGS, CFLAGS, and other build variables from your config.
- GHC 9.6+
- Stack
- Haskell libraries (automatically fetched by Stack)
cd dancer stack build
Full system rebuild from scratch
dancer rebuild --from-scratch
Incremental rebuild
dancer rebuild
Fetch latest package definitions
dancer fetch
Rebuild user homes
dancer home rebuild
Modules
- Dancer.Types: Core data types (Package, SystemConfig, LibC, etc.)
- Dancer.CLI: Command-line interface and argument parsing.
- Dancer.Config: Loading and validating Haskell config files.
- Dancer.Build: Dependency resolution, conflict checking, and build orchestration.
- Dancer.Logging: Consistent logging utilities.
Build Flow
- Parse CLI arguments
- Load /etc/dancer/system.hs config
- Resolve package dependencies
- Check for conflicts
- Build each package in order
- Create a new generation for rollback
- Print summary
Dancer automatically creates a new "generation" after each successful rebuild. These are snapshots of your system that you can rollback to.
Generations are stored in /var/lib/dancer/generations/.
To add a new command:
- Add a handler in Dancer.CLI
- Add the pattern match to runCLI
- Implement the logic
To modify the build process:
- Edit Dancer.Build
- Update the logging calls to match the style
- Test with stack build && stack exec dancer -- <command>