Skip to content

snawaz/nix-shell-action

 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 87.3%
  • JavaScript 7.5%
  • Nix 5.2%