Skip to content

custom-workflows/setup-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

setup-nix

GitHub: Release on Push

Set up a GitHub Actions Workflow with a Specific Version of Nix.

🔣 Inputs

The GitHub Action Workflow custom-workflows/setup-nix accepts the following inputs:

Name Description Required/Optional Default Example
install_url Set URL pointing to a Nix installer script. Helpful for testing or pinning Nix to a specific version. Optional - https://releases.nixos.org/nix/nix-2.28.3/install
install_options Set Nix installation options. These are passed to the Nix installer script. Optional - --no-daemon
nix_path Set NIX_PATH environment variable. Optional - nixpkgs=channel:nixos-unstable
extra_nix_config Set extra Nix configuration to append to /etc/nix/nix.conf. Optional -
extra_nix_config: |
    ...
                
enable_kvm If available, enable KVM for hardware-accelerated virtualization on Linux. Optional true false
set_current_user_as_trusted_user Set current user as trusted-users. Optional true false
github_access_token Set the GitHub access token to configure Nix to pull from GitHub. Helpful to work around rate limiting issues. Optional - ${{ secrets.GITHUB_TOKEN }}

⚙️ Usage

Create a .github/workflows/setup-nix.yaml in your GitHub Repository with the following contents:

name: "Setup Nix"

on: [push]

permissions:
    contents: "read"

jobs:
    example:
        runs-on: "ubuntu-latest"

        steps:
            - name: "GitHub: Checkout Repository"
              uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" #v4.2.2

            - name: "GitHub: Setup Nix"
              # IMPORTANT: 
              # Consider GitHub Actions Pinning for additional security.
              # See: https://stackoverflow.com/a/78905195
              uses: "custom-workflows/setup-nix@latest"
              with:
                # NOTE:
                # Set 'nix_path' by:
                #  - Picking a channel → https://status.nixos.org/
                #  - Pin 'nixpkgs' → https://nix.dev/reference/pinning-nixpkgs
                nix_path: nixpkgs=channel:nixos-unstable

            - name: "Nix: Build"
              run: |
                nix-build

🐛 Found a Bug?

Thank you for your message! Please fill out a bug report.

📖 License

This project is licensed under the European Union Public License 1.2.

About

Set up Your GitHub Actions Workflow with a Specific Version of Nix.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages