Cachix & Nix Install actions for GitHub

Hi y’all,

I’ve just pushed two GitHub actions:

a) Cachix action that allows you to run nix-build with the help of binary caches from Cachix. It’s such a simple way with a few lines of configuration to get a pretty decent Nix CI set up in a minute.

b) Install Nix action takes care of installing Nix as a step. This sounds like it should be simple, but there are quite a few caveats, so I’ve decided to abstract those away into a simple step. It’s part of Cachix’s action.

You can now instantly get access at https://github.com/features/actions, although it’s still in beta.

16 Likes

Released cachix-action-v2 with the following changes:

  • fix cachix: CppStdException "Exception: path '/nix/store/... ' is not valid; type: nix::InvalidPath"
  • don’t error out if signing key is missing (typical on pull requests)

Released install-nix-v3 with the following changes:

  • speed up builds by setting max-jobs = auto in /etc/nix/nix.conf
  • properly avoid segfault when installing Nix

Thank you all for such swift feedback :slight_smile:

2 Likes

We’re starting to discuss v3, which would allow more use cases:

  • having multiple caches to substitute from
  • getting store paths from somewhere else than plain nix-build

So if the current cachix action doesn’t cover your use case, please take look at v3 proposal:

- uses: cachix/cachix-action@v3
      with:
        mode: configure
        use: mycache mycache2
- ...
- uses: cachix/cachix-action@v3
      with:
        name: mycache
        sourceCommand: nix-build ci.nix
        signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

And comment on: https://github.com/cachix/cachix-action/issues/8#issuecomment-538332722

1 Like

Note that GitHub Actions upgraded to Catalina yesterday, which breaks installation of Nix.

I’ve let GitHub know about this (with a help of few others) and they responded they will bring back Mojave and/or disable SIP in a few weeks.

Released install-nix-action-v5 that fixes macOS Catalina support.

1 Like