{"id":14968080,"url":"https://github.com/workflow/nix-shell-action","last_synced_at":"2025-07-11T03:33:58.847Z","repository":{"id":39391850,"uuid":"293980055","full_name":"workflow/nix-shell-action","owner":"workflow","description":"Run any command you like in a deterministic Nix shell on Linux and macOS.","archived":false,"fork":false,"pushed_at":"2025-01-27T04:04:30.000Z","size":1273,"stargazers_count":46,"open_issues_count":5,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T10:11:57.348Z","etag":null,"topics":["actions","ci","nix","nix-shell"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-09T02:24:11.000Z","updated_at":"2025-03-28T10:26:37.000Z","dependencies_parsed_at":"2024-06-18T22:38:50.387Z","dependency_job_id":"12104281-4b77-471f-88e5-8cf9d172f0f2","html_url":"https://github.com/workflow/nix-shell-action","commit_stats":{"total_commits":128,"total_committers":5,"mean_commits":25.6,"dds":0.2890625,"last_synced_commit":"2faaa9c945f7dbcb790f36563c32e52bc26955bc"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workflow%2Fnix-shell-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workflow%2Fnix-shell-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workflow%2Fnix-shell-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workflow%2Fnix-shell-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workflow","download_url":"https://codeload.github.com/workflow/nix-shell-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027406,"owners_count":21035594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","ci","nix","nix-shell"],"created_at":"2024-09-24T13:39:12.996Z","updated_at":"2025-04-09T11:09:40.865Z","avatar_url":"https://github.com/workflow.png","language":"TypeScript","readme":"# nix-shell-action\n\n\u003ca href=\"https://github.com/workflow/nix-shell-action/actions\"\u003e\u003cimg alt=\"nix-shell-action status\" src=\"https://github.com/workflow/nix-shell-action/workflows/nix-shell-action-test/badge.svg\"\u003e\u003c/a\u003e\n\nRun any command you like in a deterministic [Nix](https://nixos.org/nix/) shell\non Linux and macOS.\n\n## Usage\n\nCreate `.github/workflows/test.yml` in your repo with the following contents:\n\n```yaml\nname: 'Test'\non:\n  pull_request:\n  push:\njobs:\n  tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: cachix/install-nix-action@v18\n        with:\n          nix_path: nixpkgs=channel:nixos-unstable\n      - uses: workflow/nix-shell-action@v3\n        with:\n          packages: hello,docker\n          script: |\n            hello\n            docker --help\n```\n\nYou can also pass in environment variables:\n\n```yaml\n- uses: workflow/nix-shell-action@v3\n  env:\n    TRANSFORMER: bumblecat\n  with:\n    packages: hello,docker\n    script: |\n      hello $TRANSFORMER\n      docker --help\n```\n\nFor now, this action implicitly depends on having [Nix] installed and set up\ncorrectly, such as through the [install-nix-action] demonstrated in the examples\nabove.\n\nSee also [cachix-action](https://github.com/cachix/cachix-action) for a simple\nbinary cache setup to speed up your builds and share binaries with developers.\n\n## Usage with Flakes\n\nInstead of specifying packages, you can use `flakes` to specify fully qualified\nflakes to be available in your script. This can be used for both local flakes in\na `flake.nix` in your repo, as well as external flakes.\n\n```yaml\nname: 'Test'\non:\n  pull_request:\n  push:\njobs:\n  tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - name: Install Nix\n        uses: cachix/install-nix-action@v18\n        with:\n          extra_nix_config: |\n            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}\n      - uses: workflow/nix-shell-action@v3\n        with:\n          flakes: .#hello,nixpkgs#docker\n          script: |\n            # Runs hello from a local flake.nix\n            hello\n            # Uses docker from the nixpkgs registry (see https://raw.githubusercontent.com/NixOS/flake-registry/master/flake-registry.json)\n            command -v docker\n```\n\n## Flakes from devShell\n\nInstead of specifying `flakes`, you can also tell this action to re-use the\n`buildInputs` from your `devShell` defined in a `flake.nix`, and automatically\nmake these available to the script:\n\n```yaml\nname: 'Test with Flakes from DevShell'\non:\n  pull_request:\n  push:\njobs:\n  tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - name: Install Nix\n        uses: cachix/install-nix-action@v18\n        with:\n          extra_nix_config: |\n            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}\n      - uses: workflow/nix-shell-action@v3\n        with:\n          flakes-from-devshell: true\n          script: |\n            # Runs hello from a local flake.nix with a `devShell`\n            hello\n```\n\n# Options `with: ...`\n\n- `interpreter`: Interpreter to use in the nix shell shebang, defaults to\n  `bash`. (This is passed to `nix run -c`, used to be `-i` in a nix shell\n  shebang)\n\n- `packages`: Comma-separated list of packages to pre-install in your shell.\n  Cannot be used together with the `flakes` option.\n\n- `flakes`: Comma-separated list of fully qualified flakes to pre-install in\n  your shell. Use either `packages` or `flakes`. Cannot be used together with\n  the `packages` option.\n\n- `flakes-from-devshell`: If true, supply flakes from a `devShell` provided in\n  your repo's `flake.nix`. You cannot currently combined this with the `flakes`\n  nor `packages` options.\n\n- `custom-devshell`: Specify a custom `devShell` to use. This can be useful if\n  you have a `devShell` that is not named `devShell` in your `flake.nix`. You\n  cannot currently combined this with the `flakes` nor `packages` options.\n\n- `script`: The actual script to execute in your shell. Will be passed to the\n  `interpreter`, which defaults to `bash`\n\n- `working-directory`: Execute the script inside the specified working directory\n  instead of the repository root. Example: `path/to/dir`\n\n---\n\n# FAQ: Passing a Github Token against Rate Limits\n\n```yaml\nname: 'Test'\non:\n  pull_request:\n  push:\njobs:\n  tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: cachix/install-nix-action@v18\n        with:\n          nix_path: nixpkgs=channel:nixos-unstable\n          extra_nix_config: |\n            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}\n      - uses: workflow/nix-shell-action@v3\n        with:\n          packages: hello,docker\n          script: |\n            hello\n            docker --help\n```\n\n# FAQ: How do I pin a specific version of a package?\n\nSee\n[This Explanation](https://github.com/workflow/nix-shell-action/issues/346#issuecomment-2440067512)\n\n---\n\n# Hacking\n\nSee https://github.com/actions/typescript-action\n\n[nix]: https://nixos.org/nix/\n[install-nix-action]: https://github.com/marketplace/actions/install-nix\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkflow%2Fnix-shell-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkflow%2Fnix-shell-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkflow%2Fnix-shell-action/lists"}