mdarocha/nix-magic-setup
Github Actions to setup Nix and related tooling in an opinionated way.
{ "createdAt": "2026-03-07T11:19:41Z", "defaultBranch": "main", "description": "Github Actions to setup Nix and related tooling in an opinionated way.", "fullName": "mdarocha/nix-magic-setup", "homepage": "", "language": null, "name": "nix-magic-setup", "pushedAt": "2026-03-14T03:52:30Z", "stargazersCount": 4, "topics": [], "updatedAt": "2026-03-14T03:52:26Z", "url": "https://github.com/mdarocha/nix-magic-setup"}nix-magic-setup
Section titled “nix-magic-setup”One action to install Nix, cache builds, and automate common flake workflows in GitHub Actions.
Managing Nix in GitHub Actions means wiring together multiple separate actions, getting cache config right, and re-doing it for every new repo. nix-magic-setup bundles all of that into a single drop-in action.
Features
Section titled “Features”- Installing Nix using cachix/install-nix-action
- Caching Nix derivations using nix-community/cache-nix-action
- Automagically setting up environments from
.envrcusing aldoborrero/direnv-nix-action - Commenting with mdarocha/comment-flake-lock-changelog when a PR updates
flake.lock
Example usage
Section titled “Example usage”name: CIon: pull_request: push: branches: [main]
permissions: contents: read actions: read pull-requests: write
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: mdarocha/nix-magic-setup@v1.0.0 - run: nix flake checkPermissions required
Section titled “Permissions required”This action uses the workflows’ GITHUB_TOKEN by default. Certain features require specific permissions to work.
They can be set using the permissions key in your workflow file.
Certain features also only work in the context of a cloned repository, so they require the actions/checkout action to be run before this one.
actions: read- required bycache-nix-actionto read GitHub Actions cache and purge old cache entriespull-requests: write- required bycomment-flake-lock-changelogto comment on PRscontents: read- remember to add it when setting permissions, to make sure the actions has permissions required to clone the repo
Roadmap
Section titled “Roadmap”In the future, this action is planned to also:
- Comment on PRs with nix-diff
- Show stats like build times, cache hits vs. misses in GitHub Actions summaries
- Automatically set up Nix config according to
nixConfigflake keys