guix

A CLI tool for reproducible Dart and Flutter builds with GNU Guix.

Installation

dart pub global activate guix

Quick start

# In your Flutter project root:
guix_dart init linux  # Create guix.yaml + guix/linux.scm.
guix_dart setup       # Fetch Flutter SDK.
guix_dart shell linux # Enter reproducible dev shell.
guix_dart build linux # Build (pinned, CI-safe).

Repository example

The repo includes a full example app at ../../example.

From that directory:

dart run ../packages/guix/bin/guix_dart.dart setup linux
dart run ../packages/guix/bin/guix_dart.dart build linux
./tool/hash_linux_bundle.sh --check

The normalized Linux release bundle should hash to:

6ff79e75e7fdb074f73bfa7c13095db2b6c4b92bdd25b0928d7303b618594d0a

This is the quickest way to see a complete guix.yaml and pinned guix/channels.scm before adapting the workflow to your own project. That example README also covers the subtree and standalone-script paths.

Commands

Command Description
init [linux] [android] Initialise config and manifests
setup [platforms...] Fetch Flutter SDK and platform SDKs
shell <platform> Enter an interactive Guix dev shell
build <platform> Build inside a reproducible environment
doctor Check prerequisites and configuration
pin Update guix/channels.scm from current Guix
clean Remove SDKs and build artifacts
eject Generate standalone shell scripts

Pass --help to any command for full usage.

guix.yaml schema

project:
  name: my_app

flutter:
  version: "3.24.5"
  channel: stable
  checksums:
    x86_64: ""      # SHA-256 of the downloaded tarball
    aarch64: ""

guix:
  channels: guix/channels.scm

platforms:
  linux:
    manifest: guix/linux.scm
    env:
      CC: clang
      CXX: clang++
    preserve:
      - DISPLAY
      - WAYLAND_DISPLAY
    build:
      command: flutter build linux --release
      output: build/linux/release/bundle

  android:
    manifest: guix/android.scm
    build:
      command: flutter build apk --release
      output: build/app/outputs/flutter-apk/app-release.apk

profiles:
  staging:
    platform: linux
    command: flutter build linux --release --dart-define=FLAVOR=staging
    output: build/linux/staging/bundle

Requirements

  • GNU Guix installed on the host
  • Dart SDK >=3.5.0

Ejecting

If you no longer want to depend on this tool, guix_dart eject generates self-contained shell scripts and a Makefile that reproduce the same behaviour without any Dart tooling.

Libraries