Skip to content

flox/install-flox-action

Repository files navigation

Harness the Power of Nix

Discourse   |   Documentation   |   Blog   |   Twitter

GitHub PRs Welcome GitHub tag (latest by date)

Installs flox on GitHub Actions for the supported platforms: Linux and macOS.

flox is a command line tool that helps you manage your environments. flox builds on top of the powerful ideas of Nix as well as making them accessible to everybody.

⭐ Getting Started

Create .github/workflows/ci.yml in your repo with the following contents:

name: "CI"

on:
  pull_request:
  push:

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:

    - name: Checkout
      uses: actions/checkout@v3

    - name: Install flox
      uses: flox/install-flox-action@v2

    - name: Build
      run: flox build

🚀 Add caching for faster CI

Caching with flox can be achieved by configuring what is known as substituter.

You can see in an example below how to configure your GitHub workflow to push build artifacts to a remote location. In the case of this example it is an AWS S3 Bucket.

With caching configured all subsequent builds will be faster since flox does not have to build them again.

See nix help-stores for more information on the supported URIs.

name: "CI"

on:
  push:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:

    - name: Checkout
      uses: actions/checkout@v3

    - name: Install flox
      uses: flox/install-flox-action@v2
      with:
        substituter: s3://your-cache-here # see `nix help-stores` for supported uris
        substituter-key: ${{ secrets.FLOX_STORE_PUBLIC_NIX_SECRET_KEY }}
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

    - name: Build
      run: |
        flox build

Builders

Can configure remote builders via:

        remote-builders: |
            ssh://user@host x86_64-linux /ssh-key - - - - <base64_ssh_host_key>
            ssh://user@host aarch64-linux /ssh-key - - - - <base64_ssh_host_key>
            ssh://user@host x86_64-darwin /ssh-key - - - - <base64_ssh_host_key>
            ssh://user@host aarch64-darwin /ssh-key - - - - <base64_ssh_host_key>

Read more about the remote builders format.

📫 Have a question? Want to chat? Ran into a problem?

We are happy to welcome you to our Discourse forum and answer your questions! You can always reach out to us directly via the flox twitter account or chat to us directly on Matrix or Discord.

🤝 Found a bug? Missing a specific feature?

Feel free to file a new issue with a respective title and description on the the flox/install-flox-action repository. If you already found a solution to your problem, we would love to review your pull request!

🪪 License

The install-flox-action is licensed under the MIT. See LICENSE.