Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

Nix Shell

Actions
Run any command you like in a deterministic nix shell on Linux and macOS
v3.0.1
Star (42)

nix-shell-action

nix-shell-action status

Run any command you like in a deterministic Nix shell on Linux and macOS.

Usage

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

name: "Test"
on:
  pull_request:
  push:
jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: cachix/install-nix-action@v10
      with:
        nix_path: nixpkgs=channel:nixos-unstable
    - uses: workflow/nix-shell-action@v1
      with:
        packages: hello,docker
        script: |
          hello
          docker --help

You can also pass in environment variables:

    - uses: workflow/nix-shell-action@v1
      env:
        TRANSFORMER: bumblecat
      with:
        packages: hello,docker
        script: |
          hello $TRANSFORMER
          docker --help

For now, this action implicitly depends on having Nix installed and set up correctly, such as through the install-nix-action demonstrated in the examples above.

See also cachix-action for a simple binary cache setup to speed up your builds and share binaries with developers.

Options with: ...

  • interpreter: Interpreter to use in the nix shell shebang, defaults to bash. (This is passed to nix run -c, used to be -i in a nix shell shebang)

  • packages: Comma-separated list of packages to pre-install in your shell. Defaults to just bash

  • script: The actual script to execute in your shell. Will be passed to the interpreter, which defaults to bash


Hacking

See https://github.com/actions/typescript-action

Nix Shell is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Run any command you like in a deterministic nix shell on Linux and macOS
v3.0.1

Nix Shell is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.