Reproducible Builds
This guide shows how to build Clementine CLI reproducibly using Nix and verify your build matches the official release.
Reproducible builds ensure bit-for-bit identical binaries, allowing you to verify that published binaries match the source code exactly.
Platform Support
4 platforms are fully supported and reproducible:
Linux
x86_64, ARM64
Windows
x86_64
macOS
Apple Silicon
What You Can Build
Linux (x86_64)
Linux x86_64, Windows
Linux (ARM64)
Linux ARM64
macOS (Apple Silicon)
macOS Apple Silicon
Install Nix
sh <(curl -L https://nixos.org/nix/install) --daemonEnable flakes (required):
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
# Restart Nix daemon
# Linux:
sudo systemctl restart nix-daemon
# macOS:
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plistBuild
Supported Platforms
Working Platforms
Build commands for all working platforms:
Binary location: ./result/bin/clementine-cli (or .exe for Windows)
Platform-Specific Build Instructions
From Linux
Linux can build for its native architecture and Windows (from x86_64):
From macOS
Apple Silicon Macs can build for their native platform. macOS Intel builds are not supported by the current flake targets.
Development Environment
Enter a development shell with all dependencies:
This provides a shell with Rust 1.89.0 and all required build dependencies.
Verifying Reproducibility
Quick Test
Use --rebuild flag to force a rebuild even if the output already exists in the store. This is helpful for debugging and testing reproducibility without clearing the result directory.
Full Verification (recommended for release verification)
Test with a completely clean Nix store to ensure no cached artifacts affect the build:
Cross-Machine Verification
To verify your build matches another developer's:
Ensure identical source: Both machines must be on the same git commit/tag
Build the binary: Run
nix build .#<platform>Compare hashes: Both should produce identical
nix hash path ./resultandsha256sum ./result/bin/clementine-clioutput.
If hashes don't match, verify:
Same git commit/tag:
git rev-parse HEADSame Nix version:
nix --version(recommended: 2.32.1)Clean build if needed:
nix store gc --max 0before rebuilding
Verifying Downloaded Binaries
If you downloaded a pre-built binary from GitHub Releases, you can verify it matches the source code by building it yourself and comparing hashes.
Step 1: Check the Release Tag
Step 2: Build the Binary
Step 3: Compare Binaries
If the SHA256 hashes match, your downloaded binary is bit-for-bit identical to what the source code produces. This proves:
The binary matches the published source code exactly
No modifications were made between building and distribution
The build process is reproducible
If hashes don't match, ensure you're using the exact same release tag and building for the correct platform.
Troubleshooting
Hash Doesn't Match
If your hash doesn't match the expected value:
Ensure you're on the same git commit/tag
Check your Nix version:
nix --versionForce a rebuild:
nix build .#<platform> --rebuildTry a clean build:
nix store gc --max 0then rebuild (takes 10-20 min)
Common Issues
"experimental-features not enabled"
Add experimental-features = nix-command flakes to ~/.config/nix/nix.conf and restart Nix daemon
Slow first build
Normal - ~500 packages built (10-20 min). Subsequent builds are cached (1-2 min)
Out of disk space
Run nix store gc for cleanup or nix store gc --max 0 for full cleanup (~36GB freed)
Windows build fails from macOS
Not supported - use Linux x86_64 to build Windows binaries
Linux ARM64 build fails from macOS
Not supported - use Linux ARM64 to build Linux ARM64 binaries
Cleaning Build Cache
Next build after full cleanup will take 10-20 minutes.
Use full cleanup when:
Testing reproducibility with a clean slate
Freeing disk space
Resolving cache issues
Additional Resources
Last updated
Was this helpful?