├── .gitignore ├── .github ├── dependabot.yml └── workflows │ ├── update-nix.yml │ ├── test.yml │ └── test-per-system.yml ├── .editorconfig ├── tests ├── test-build.nix └── test-env.sh ├── RELEASE.md ├── action.yml ├── install-nix.sh ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | # dotenv environment variables file 2 | .env* 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: github-actions 5 | directory: "/" 6 | schedule: 7 | interval: daily 8 | time: '00:00' 9 | timezone: UTC 10 | open-pull-requests-limit: 10 11 | commit-message: 12 | prefix: "chore" 13 | include: "scope" -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_size = 2 11 | indent_style = space 12 | insert_final_newline = true 13 | 14 | [LICENSE] 15 | indent_size = unset 16 | -------------------------------------------------------------------------------- /tests/test-build.nix: -------------------------------------------------------------------------------- 1 | # Realizes > of derivations with size of MB 2 | { size ? 1 # MB 3 | , num ? 10 # count 4 | , currentTime ? builtins.currentTime 5 | , noChroot ? false 6 | }: 7 | 8 | with import {}; 9 | 10 | let 11 | drv = i: runCommand "${toString currentTime}-${toString i}" { 12 | __noChroot = noChroot; 13 | } '' 14 | dd if=/dev/zero of=$out bs=${toString size}MB count=1 15 | ''; 16 | in writeText "empty-${toString num}-${toString size}MB" '' 17 | ${lib.concatMapStringsSep "" drv (lib.range 1 num)} 18 | '' 19 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Release 2 | 3 | As of v31, releases of this action follow Semantic Versioning. 4 | 5 | ### Publishing a new release 6 | 7 | #### Publish the release 8 | 9 | Draft [a new release on GitHub](https://github.com/cachix/install-nix-action/releases): 10 | 11 | - In `Choose a tag`, create a new tag, like `v31.2.1`, following semver. 12 | - Click `Generate release notes`. 13 | - `Set as the latest release` should be selected automatically. 14 | - Publish release 15 | 16 | #### Update the major tag 17 | 18 | The major tag, like `v31`, allows downstream users to opt-in to automatic non-breaking updates. 19 | 20 | This process follows GitHub's own guidelines: 21 | https://github.com/actions/toolkit/blob/main/docs/action-versioning.md 22 | 23 | ##### Fetch the latest tags 24 | 25 | ``` 26 | git pull --tags --force 27 | ``` 28 | 29 | ##### Move the tag 30 | 31 | ``` 32 | git tag -fa v31 33 | ``` 34 | ``` 35 | git push origin v31 --force 36 | ``` 37 | 38 | #### Update the release notes for the major tag 39 | 40 | Find the release on GitHub: https://github.com/cachix/install-nix-action/releases 41 | 42 | Edit the release and click `Generate release notes`. 43 | Edit the formatting and publish. 44 | 45 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Install Nix' 2 | description: 'Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.' 3 | author: 'Domen Kožar' 4 | inputs: 5 | extra_nix_config: 6 | description: 'Gets appended to `/etc/nix/nix.conf` if passed.' 7 | github_access_token: 8 | description: 'Configure Nix to pull from GitHub using the given GitHub token.' 9 | install_url: 10 | description: 'Installation URL that will contain a script to install Nix.' 11 | install_options: 12 | description: 'Additional installer flags passed to the installer script.' 13 | nix_path: 14 | description: 'Set NIX_PATH environment variable.' 15 | enable_kvm: 16 | description: 'Enable KVM for hardware-accelerated virtualization on Linux, if available.' 17 | required: false 18 | default: true 19 | set_as_trusted_user: 20 | description: 'Add current user to `trusted-users`.' 21 | required: false 22 | default: true 23 | branding: 24 | color: 'blue' 25 | icon: 'sun' 26 | runs: 27 | using: 'composite' 28 | steps: 29 | - run : ${GITHUB_ACTION_PATH}/install-nix.sh 30 | shell: bash 31 | env: 32 | INPUT_EXTRA_NIX_CONFIG: ${{ inputs.extra_nix_config }} 33 | INPUT_GITHUB_ACCESS_TOKEN: ${{ inputs.github_access_token }} 34 | INPUT_INSTALL_OPTIONS: ${{ inputs.install_options }} 35 | INPUT_INSTALL_URL: ${{ inputs.install_url }} 36 | INPUT_NIX_PATH: ${{ inputs.nix_path }} 37 | INPUT_ENABLE_KVM: ${{ inputs.enable_kvm }} 38 | INPUT_SET_AS_TRUSTED_USER: ${{ inputs.set_as_trusted_user }} 39 | GITHUB_TOKEN: ${{ github.token }} 40 | -------------------------------------------------------------------------------- /tests/test-env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | echo "=== Testing Nix Environment Variables ===" 6 | echo 7 | 8 | # Test NIX_PROFILES 9 | echo "NIX_PROFILES: ${NIX_PROFILES:-}" 10 | if [[ -n "${NIX_PROFILES:-}" ]]; then 11 | echo "✓ NIX_PROFILES is set" 12 | else 13 | echo "✗ NIX_PROFILES is not set" 14 | exit 1 15 | fi 16 | 17 | # Test NIX_SSL_CERT_FILE 18 | echo "NIX_SSL_CERT_FILE: ${NIX_SSL_CERT_FILE:-}" 19 | if [[ -n "${NIX_SSL_CERT_FILE:-}" ]]; then 20 | if [[ -f "$NIX_SSL_CERT_FILE" ]]; then 21 | echo "✓ NIX_SSL_CERT_FILE is set and file exists" 22 | else 23 | echo "✗ NIX_SSL_CERT_FILE is set but file does not exist: $NIX_SSL_CERT_FILE" 24 | exit 1 25 | fi 26 | else 27 | echo "✗ NIX_SSL_CERT_FILE is not set" 28 | exit 1 29 | fi 30 | 31 | # Test PATH contains Nix paths 32 | echo "PATH: $PATH" 33 | if echo "$PATH" | grep -E -q "(\.nix-profile|nix/profile)"; then 34 | echo "✓ PATH contains Nix paths" 35 | else 36 | echo "✗ PATH does not contain Nix paths" 37 | exit 1 38 | fi 39 | 40 | # Test NIX_PATH if set 41 | if [[ -n "${NIX_PATH:-}" ]]; then 42 | echo "NIX_PATH: $NIX_PATH" 43 | echo "✓ NIX_PATH is set" 44 | else 45 | echo "NIX_PATH: " 46 | exit 1 47 | fi 48 | 49 | # Test TMPDIR 50 | echo "TMPDIR: ${TMPDIR:-}" 51 | if [[ -n "${TMPDIR:-}" ]]; then 52 | echo "✓ TMPDIR is set" 53 | else 54 | echo "⚠ TMPDIR is not set" 55 | exit 1 56 | fi 57 | 58 | echo 59 | echo "=== Testing Nix Command ===" 60 | if command -v nix >/dev/null 2>&1; then 61 | echo "✓ nix command is available" 62 | echo "Nix version: $(nix --version)" 63 | else 64 | echo "✗ nix command is not available" 65 | exit 1 66 | fi 67 | 68 | echo 69 | echo "=== Environment Setup Test Complete ===" 70 | -------------------------------------------------------------------------------- /.github/workflows/update-nix.yml: -------------------------------------------------------------------------------- 1 | name: "Update nix" 2 | on: 3 | repository_dispatch: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "31 2 * * *" 7 | jobs: 8 | update-nix-releases: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v6 12 | - name: Update nix releases 13 | env: 14 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | run: | 16 | latest_nix=$( 17 | gh api repos/NixOS/nix/tags --paginate --jq '.[].name' | 18 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | 19 | sort -V | 20 | tail -n 1 21 | ) 22 | if [ -z "$latest_nix" ]; then 23 | echo "Failed to determine latest Nix version." >&2 24 | exit 1 25 | fi 26 | current_nix=$(grep -oE 'nix_version=[0-9.]+' ./install-nix.sh | cut -d= -f2) 27 | echo "Current Nix version: ${current_nix}" 28 | echo "Latest Nix version: ${latest_nix}" 29 | echo "CURRENT_NIX=${current_nix}" >> $GITHUB_ENV 30 | echo "LATEST_NIX=${latest_nix}" >> $GITHUB_ENV 31 | sed -i -E "s/nix_version=[0-9.]+/nix_version=${latest_nix}/" ./install-nix.sh 32 | - name: Create Pull Request 33 | uses: peter-evans/create-pull-request@v8 34 | with: 35 | title: "nix: ${{ env.CURRENT_NIX }} -> ${{ env.LATEST_NIX }}" 36 | commit-message: "nix: ${{ env.CURRENT_NIX }} -> ${{ env.LATEST_NIX }}" 37 | body: | 38 | This PR updates the Nix version from ${{ env.CURRENT_NIX }} to ${{ env.LATEST_NIX }}. 39 | 40 | **To trigger the CI:** 41 | 42 | 1. Checkout the PR branch: 43 | ```bash 44 | gh pr checkout 45 | ``` 46 | 47 | 2. Amend and force push: 48 | ```bash 49 | git commit --amend --no-edit 50 | git push --force-with-lease 51 | ``` 52 | labels: dependencies 53 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: "install-nix-action test" 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - master 7 | workflow_dispatch: 8 | 9 | env: 10 | nixpkgs_channel: nixpkgs=channel:nixos-25.05 11 | 12 | jobs: 13 | test: 14 | strategy: 15 | fail-fast: false 16 | # For the list of available images: 17 | # GitHub images: https://github.com/actions/runner-images?tab=readme-ov-file#available-images 18 | # Partner images: https://github.com/actions/partner-runner-images?tab=readme-ov-file#available-images 19 | matrix: 20 | include: 21 | - runs-on: ubuntu-latest 22 | system: x86_64-linux 23 | oldest_installer_version: nix-2.8.0 24 | - runs-on: ubuntu-22.04 25 | system: x86_64-linux 26 | oldest_installer_version: nix-2.8.0 27 | - runs-on: ubuntu-24.04-arm 28 | system: aarch64-linux 29 | oldest_installer_version: nix-2.8.0 30 | - runs-on: ubuntu-22.04-arm 31 | system: aarch64-linux 32 | oldest_installer_version: nix-2.8.0 33 | - runs-on: macos-latest 34 | system: aarch64-darwin 35 | oldest_installer_version: nix-2.18.6 36 | - runs-on: macos-26 37 | system: aarch64-darwin 38 | oldest_installer_version: nix-2.18.6 39 | - runs-on: macos-15 40 | system: aarch64-darwin 41 | oldest_installer_version: nix-2.18.6 42 | - runs-on: macos-14 43 | system: aarch64-darwin 44 | oldest_installer_version: nix-2.8.0 45 | - runs-on: macos-15-intel 46 | system: x86_64-darwin 47 | oldest_installer_version: nix-2.18.6 48 | uses: ./.github/workflows/test-per-system.yml 49 | with: 50 | runs-on: ${{ matrix.runs-on }} 51 | system: ${{ matrix.system }} 52 | oldest_installer_version: ${{ matrix.oldest_installer_version }} 53 | 54 | act-support: 55 | runs-on: ubuntu-latest 56 | steps: 57 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 58 | - run: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash 59 | - run: docker pull ghcr.io/catthehacker/ubuntu:js-24.04 60 | - run: | 61 | ./bin/act push \ 62 | -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-24.04 \ 63 | -j simple-build \ 64 | --matrix runs-on:ubuntu-latest \ 65 | --matrix system:x86_64-linux 66 | -------------------------------------------------------------------------------- /.github/workflows/test-per-system.yml: -------------------------------------------------------------------------------- 1 | name: Test Runner 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | runs-on: 7 | description: 'GitHub Actions runner to use (e.g., ubuntu-latest, macos-latest)' 8 | required: true 9 | type: string 10 | system: 11 | description: 'Target system architecture (e.g., x86_64-linux, aarch64-darwin)' 12 | required: true 13 | type: string 14 | oldest_installer_version: 15 | description: 'Oldest supported Nix installer version to test (e.g., nix-2.8.0)' 16 | required: false 17 | default: 'nix-2.8.0' 18 | type: string 19 | 20 | env: 21 | nixpkgs_channel: nixpkgs=channel:nixos-25.05 22 | 23 | jobs: 24 | simple-build: 25 | runs-on: ${{ inputs.runs-on }} 26 | steps: 27 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 28 | - name: Install Nix 29 | uses: ./ 30 | with: 31 | nix_path: ${{ env.nixpkgs_channel }} 32 | - name: Test environment variables 33 | run: ./tests/test-env.sh 34 | - run: nix-env -iA cachix -f https://cachix.org/api/v1/install 35 | - run: cat /etc/nix/nix.conf 36 | # cachix should be available and be able to configure a cache 37 | - run: cachix use cachix 38 | - run: nix-build tests/test-build.nix 39 | 40 | custom-nix-path: 41 | runs-on: ${{ inputs.runs-on }} 42 | steps: 43 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 44 | - name: Install Nix 45 | uses: ./ 46 | with: 47 | nix_path: ${{ env.nixpkgs_channel }} 48 | - run: test $NIX_PATH == '${{ env.nixpkgs_channel }}' 49 | - run: nix-build tests/test-build.nix 50 | 51 | extra-nix-config: 52 | runs-on: ${{ inputs.runs-on }} 53 | steps: 54 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 55 | - name: Install Nix 56 | uses: ./ 57 | with: 58 | nix_path: ${{ env.nixpkgs_channel }} 59 | extra_nix_config: | 60 | sandbox = relaxed 61 | - run: cat /etc/nix/nix.conf 62 | - run: nix-build tests/test-build.nix --arg noChroot true 63 | 64 | flakes: 65 | runs-on: ${{ inputs.runs-on }} 66 | steps: 67 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 68 | - name: Install Nix 69 | uses: ./ 70 | - run: nix flake show github:NixOS/nixpkgs 71 | 72 | latest-installer: 73 | runs-on: ${{ inputs.runs-on }} 74 | steps: 75 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 76 | - name: Run NAR server 77 | run: | 78 | curl --location https://github.com/cachix/nar-toolbox/releases/download/v0.1.0/nar-toolbox-${{ inputs.system }} -O 79 | chmod +x ./nar-toolbox-${{ inputs.system }} 80 | ./nar-toolbox-${{ inputs.system }} serve https://cache.nixos.org & 81 | - name: Install Nix 82 | uses: ./ 83 | with: 84 | nix_path: ${{ env.nixpkgs_channel }} 85 | install_url: https://hydra.nixos.org/job/nix/master/installerScript/latest-finished/download/1/install 86 | install_options: "--tarball-url-prefix http://localhost:8080" 87 | - run: nix-build tests/test-build.nix 88 | 89 | oldest-supported-installer: 90 | runs-on: ${{ inputs.runs-on }} 91 | steps: 92 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 93 | - name: Install Nix 94 | uses: ./ 95 | with: 96 | nix_path: ${{ env.nixpkgs_channel }} 97 | install_url: https://releases.nixos.org/nix/${{ inputs.oldest_installer_version }}/install 98 | - run: nix-build tests/test-build.nix 99 | -------------------------------------------------------------------------------- /install-nix.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | if nix_path="$(type -p nix)"; then 5 | echo "Aborting: Nix is already installed at ${nix_path}" 6 | exit 7 | fi 8 | 9 | if [[ ($OSTYPE =~ linux) && ($INPUT_ENABLE_KVM == 'true') ]]; then 10 | enable_kvm() { 11 | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-install-nix-action-kvm.rules 12 | sudo udevadm control --reload-rules && sudo udevadm trigger --name-match=kvm 13 | } 14 | 15 | echo '::group::Enabling KVM support' 16 | enable_kvm && echo 'Enabled KVM' || echo 'KVM is not available' 17 | echo '::endgroup::' 18 | fi 19 | 20 | # GitHub command to put the following log messages into a group which is collapsed by default 21 | echo "::group::Installing Nix" 22 | 23 | # Create a temporary workdir 24 | workdir=$(mktemp -d) 25 | trap 'rm -rf "$workdir"' EXIT 26 | 27 | # Configure Nix 28 | add_config() { 29 | echo "$1" >>"$workdir/nix.conf" 30 | } 31 | add_config "show-trace = true" 32 | # Set jobs to number of cores 33 | add_config "max-jobs = auto" 34 | # Configure the nix-daemon to use certificates. 35 | # In multi-user installs, NIX_SSL_CERT_FILE only works if set in the daemon's service file. 36 | if [[ $OSTYPE =~ darwin ]]; then 37 | add_config "ssl-cert-file = /etc/ssl/cert.pem" 38 | fi 39 | # Allow binary caches specified at user level 40 | if [[ $INPUT_SET_AS_TRUSTED_USER == 'true' ]]; then 41 | add_config "trusted-users = root ${USER:-}" 42 | fi 43 | # Add a GitHub access token. 44 | # Token-less access is subject to lower rate limits. 45 | if [[ -n "${INPUT_GITHUB_ACCESS_TOKEN:-}" ]]; then 46 | echo "::debug::Using the provided github_access_token for github.com" 47 | add_config "access-tokens = github.com=$INPUT_GITHUB_ACCESS_TOKEN" 48 | # Use the default GitHub token if available. 49 | # Skip this step if running an Enterprise instance. The default token there does not work for github.com. 50 | elif [[ -n "${GITHUB_TOKEN:-}" && $GITHUB_SERVER_URL == "https://github.com" ]]; then 51 | echo "::debug::Using the default GITHUB_TOKEN for github.com" 52 | add_config "access-tokens = github.com=$GITHUB_TOKEN" 53 | else 54 | echo "::debug::Continuing without a GitHub access token" 55 | fi 56 | # Append extra nix configuration if provided 57 | if [[ -n "${INPUT_EXTRA_NIX_CONFIG:-}" ]]; then 58 | add_config "$INPUT_EXTRA_NIX_CONFIG" 59 | fi 60 | if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then 61 | add_config "experimental-features = nix-command flakes" 62 | fi 63 | # Always allow substituting from the cache, even if the derivation has `allowSubstitutes = false`. 64 | # This is a CI optimisation to avoid having to download the inputs for already-cached derivations to rebuild trivial text files. 65 | if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "always-allow-substitutes" ]]; then 66 | add_config "always-allow-substitutes = true" 67 | fi 68 | 69 | # Nix installer flags 70 | installer_options=( 71 | --no-channel-add 72 | --nix-extra-conf-file "$workdir/nix.conf" 73 | ) 74 | 75 | # Enable daemon on macOS and Linux systems with systemd, unless --no-daemon is specified 76 | if [[ (! $INPUT_INSTALL_OPTIONS =~ "--no-daemon") && ($OSTYPE =~ darwin || -e /run/systemd/system) ]]; then 77 | use_daemon() { true; } 78 | else 79 | use_daemon() { false; } 80 | fi 81 | 82 | if use_daemon; then 83 | installer_options+=( 84 | --daemon 85 | --daemon-user-count "$(python3 -c 'import multiprocessing as mp; print(mp.cpu_count() * 2)')" 86 | ) 87 | else 88 | # "fix" the following error when running nix* 89 | # error: the group 'nixbld' specified in 'build-users-group' does not exist 90 | add_config "build-users-group =" 91 | sudo mkdir -p /etc/nix 92 | sudo chmod 0755 /etc/nix 93 | sudo cp "$workdir/nix.conf" /etc/nix/nix.conf 94 | fi 95 | 96 | if [[ -n "${INPUT_INSTALL_OPTIONS:-}" ]]; then 97 | IFS=' ' read -r -a extra_installer_options <<<"$INPUT_INSTALL_OPTIONS" 98 | installer_options=("${extra_installer_options[@]}" "${installer_options[@]}") 99 | fi 100 | 101 | echo "installer options: ${installer_options[*]}" 102 | 103 | # There is --retry-on-errors, but only newer curl versions support that 104 | curl_retries=5 105 | nix_version=2.33.0 106 | while ! curl -sS -o "$workdir/install" -v --fail -L "${INPUT_INSTALL_URL:-https://releases.nixos.org/nix/nix-${nix_version}/install}"; do 107 | sleep 1 108 | ((curl_retries--)) 109 | if [[ $curl_retries -le 0 ]]; then 110 | echo "curl retries failed" >&2 111 | exit 1 112 | fi 113 | done 114 | 115 | sh "$workdir/install" "${installer_options[@]}" 116 | 117 | # Configure the environment 118 | # 119 | # Adapted from the single- and multi-user scripts: 120 | # single-user: https://github.com/NixOS/nix/blob/master/scripts/nix-profile-daemon.sh.in 121 | # multi-user: https://github.com/NixOS/nix/blob/master/scripts/nix-profile-daemon.sh.in 122 | # 123 | # These scripts would normally be evaluated as part of the user's shell profile. 124 | # GitHub doesn't evaluate profiles or rc scripts by default, so we set up the environment manually. 125 | echo "::debug::Nix installed, setting up environment" 126 | 127 | # Export the path to Nix 128 | if [[ -n "${INPUT_NIX_PATH:-}" ]]; then 129 | echo "NIX_PATH=${INPUT_NIX_PATH}" >>"$GITHUB_ENV" 130 | fi 131 | 132 | # Set temporary directory if not already set 133 | # Fixes https://github.com/cachix/install-nix-action/issues/197 134 | if [[ -z "${TMPDIR:-}" ]]; then 135 | echo "TMPDIR=${RUNNER_TEMP}" >>"$GITHUB_ENV" 136 | fi 137 | 138 | # Determine the profile path. 139 | # 140 | # Different versions of Nix support (from newest to oldest): 141 | # - NIX_STATE_HOME to fully control the location of home files 142 | # - XDG_STATE_HOME, defaulting to .local/state/nix/profile 143 | # - $HOME/.nix-profile 144 | # 145 | # These directories are created by calling `nix profile`, so they don't exist at this point. 146 | # Without parsing the Nix version, our best bet is the legacy-ish ~/.nix-profile. 147 | if [[ -n "${NIX_STATE_HOME:-}" ]]; then 148 | NIX_LINK="$NIX_STATE_HOME/profile" 149 | else 150 | NIX_LINK="$HOME/.nix-profile" 151 | fi 152 | 153 | # Set Nix profiles 154 | echo "NIX_PROFILES=/nix/var/nix/profiles/default $NIX_LINK" >>"$GITHUB_ENV" 155 | 156 | # Set NIX_SSL_CERT_FILE if not already configured 157 | if [[ -z "${NIX_SSL_CERT_FILE:-}" ]]; then 158 | # Check common SSL certificate file locations 159 | if [[ -e "/etc/ssl/certs/ca-certificates.crt" ]]; then # NixOS, Ubuntu, Debian, Gentoo, Arch 160 | echo "NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt" >>"$GITHUB_ENV" 161 | elif [[ $OSTYPE =~ darwin && -e "/etc/ssl/cert.pem" ]]; then # macOS 162 | echo "NIX_SSL_CERT_FILE=/etc/ssl/cert.pem" >>"$GITHUB_ENV" 163 | elif [[ -e "/etc/ssl/ca-bundle.pem" ]]; then # openSUSE Tumbleweed 164 | echo "NIX_SSL_CERT_FILE=/etc/ssl/ca-bundle.pem" >>"$GITHUB_ENV" 165 | elif [[ -e "/etc/ssl/certs/ca-bundle.crt" ]]; then # Old NixOS 166 | echo "NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt" >>"$GITHUB_ENV" 167 | elif [[ -e "/etc/pki/tls/certs/ca-bundle.crt" ]]; then # Fedora, CentOS 168 | echo "NIX_SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt" >>"$GITHUB_ENV" 169 | elif [[ -e "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt" ]]; then # fall back to cacert in default Nix profile 170 | echo "NIX_SSL_CERT_FILE=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt" >>"$GITHUB_ENV" 171 | elif [[ -e "$NIX_LINK/etc/ssl/certs/ca-bundle.crt" ]]; then # fall back to cacert in user Nix profile 172 | echo "NIX_SSL_CERT_FILE=$NIX_LINK/etc/ssl/certs/ca-bundle.crt" >>"$GITHUB_ENV" 173 | fi 174 | fi 175 | 176 | # Set paths based on the installation type 177 | if use_daemon; then 178 | # Multi-user daemon install - add both paths 179 | echo "/nix/var/nix/profiles/default/bin" >>"$GITHUB_PATH" 180 | fi 181 | # Always add the user profile path 182 | echo "$NIX_LINK/bin" >>"$GITHUB_PATH" 183 | 184 | # Close the log message group which was opened above 185 | echo "::endgroup::" 186 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # install-nix-action 2 | 3 | [![Tests](https://github.com/cachix/install-nix-action/actions/workflows/test.yml/badge.svg)](https://github.com/cachix/install-nix-action/actions/workflows/test.yml) 4 | 5 | Installs [Nix](https://nixos.org/nix/) on GitHub Actions runners for Linux and macOS. 6 | 7 | # Features 8 | 9 | - Quick installation (~4s on Linux / ~20s on macOS) 10 | - Multi-user installation with sandboxing enabled by default on Linux 11 | - Support for [self-hosted GitHub runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) 12 | - Allows specifying Nix installation URL via `install_url` (the oldest supported Nix version is 2.3.5) 13 | - Allows specifying extra Nix configuration options via `extra_nix_config` 14 | - Allows specifying `$NIX_PATH` and channels via `nix_path` 15 | - Enables KVM on supported machines: run VMs and NixOS tests with full hardware-acceleration 16 | - Pair with a binary cache from [cachix-action](https://github.com/cachix/cachix-action) to speed up re-builds and share binaries across your team 17 | 18 | ## Usage 19 | 20 | Create `.github/workflows/test.yml` in your repo with the following contents: 21 | 22 | ```yaml 23 | name: "Test" 24 | on: 25 | pull_request: 26 | push: 27 | jobs: 28 | tests: 29 | runs-on: ubuntu-latest 30 | steps: 31 | - uses: actions/checkout@v5 32 | - uses: cachix/install-nix-action@v31 33 | with: 34 | nix_path: nixpkgs=channel:nixos-unstable 35 | - run: nix-build 36 | ``` 37 | 38 | ## Usage with Flakes 39 | 40 | ```yaml 41 | name: "Test" 42 | on: 43 | pull_request: 44 | push: 45 | jobs: 46 | tests: 47 | runs-on: ubuntu-latest 48 | steps: 49 | - uses: actions/checkout@v5 50 | - uses: cachix/install-nix-action@v31 51 | with: 52 | github_access_token: ${{ secrets.GITHUB_TOKEN }} 53 | - run: nix build 54 | - run: nix flake check 55 | ``` 56 | 57 | ## Inputs 58 | 59 | | Name | Description | Default | 60 | |------|-------------|---------| 61 | | `install_url` | URL to install Nix from. Useful for testing non-stable releases or pinning a specific Nix version (e.g., ) | `""` | 62 | | `install_options` | Additional flags to pass to the Nix installer script | `""` | 63 | | `extra_nix_config` | Additional configuration to append to `/etc/nix/nix.conf` | `""` | 64 | | `nix_path` | Value to set for the `NIX_PATH` environment variable (e.g., `nixpkgs=channel:nixos-unstable`) | `""` | 65 | | `github_access_token` | GitHub token for Nix to use when pulling from GitHub repositories. Helps work around rate limit issues. Has no effect when `access-tokens` is specified in `extra_nix_config`. | `$GITHUB_TOKEN` if available | 66 | | `set_as_trusted_user` | Add the current user to the `trusted-users` list | `true` | 67 | | `enable_kvm` | Enable KVM for hardware-accelerated virtualization on Linux | `true` | 68 | 69 | ## Differences from the default Nix installer 70 | 71 | Some settings have been optimised for use in CI environments: 72 | 73 | - `nix.conf` settings. Override these defaults with `extra_nix_config`: 74 | 75 | - The experimental `flakes` and `nix-command` features are enabled. Disable by overriding `experimental-features` in `extra_nix_config`. 76 | 77 | - `max-jobs` is set to `auto`. 78 | 79 | - `show-trace` is set to `true`. 80 | 81 | - `$USER` is added to `trusted-users`. 82 | 83 | - `$GITHUB_TOKEN` is added to `access_tokens` if no other `github_access_token` is provided. 84 | 85 | - `always-allow-substitutes` is set to `true`. 86 | 87 | - `ssl-cert-file` is set to `/etc/ssl/cert.pem` on macOS. 88 | 89 | - KVM is enabled on Linux if available. Disable by setting `enable_kvm: false`. 90 | 91 | - `$TMPDIR` is set to `$RUNNER_TEMP` if empty. 92 | 93 | --- 94 | 95 | ## FAQ 96 | 97 | ### How do I print the nixpkgs version I've configured? 98 | 99 | ```yaml 100 | - name: Print nixpkgs version 101 | run: nix-instantiate --eval -E '(import {}).lib.version' 102 | ``` 103 | 104 | ### How do I add a nixpkgs channel? 105 | 106 | This action doesn't set up any channels by default. 107 | Use `nix_path` to configure optional channels by [picking a channel](https://status.nixos.org/) or [pinning nixpkgs](https://nix.dev/reference/pinning-nixpkgs) to a specific commit. 108 | 109 | ```yaml 110 | - uses: cachix/install-nix-action@v31 111 | with: 112 | nix_path: nixpkgs=channel:nixos-unstable 113 | ``` 114 | 115 | See also the [tutorial on pinning on nix.dev](https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs). 116 | 117 | ### How do I run NixOS tests on Linux? 118 | 119 | ```yaml 120 | - uses: cachix/install-nix-action@v31 121 | with: 122 | enable_kvm: true 123 | extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm" 124 | ``` 125 | 126 | ### How do I install packages via nix-env from the specified `nix_path`? 127 | 128 | ``` 129 | nix-env -i mypackage -f '' 130 | ``` 131 | 132 | ### How do I add a binary cache? 133 | 134 | If the binary cache you want to add is hosted on [Cachix](https://cachix.org/) and you are 135 | using [cachix-action](https://github.com/cachix/cachix-action), you 136 | should use their `extraPullNames` input like this: 137 | 138 | ```yaml 139 | - uses: cachix/cachix-action@v31 140 | with: 141 | name: mycache 142 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 143 | extraPullNames: nix-community 144 | ``` 145 | 146 | Otherwise, you can add any binary cache to nix.conf using 147 | install-nix-action's own `extra_nix_config` input: 148 | 149 | ```yaml 150 | - uses: cachix/install-nix-action@v31 151 | with: 152 | extra_nix_config: | 153 | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 154 | substituters = https://hydra.iohk.io https://cache.nixos.org/ 155 | ``` 156 | 157 | ### How do I configure steps to use my flake's development environment? 158 | 159 | You can configure [`jobs..steps[*].shell`](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsshell) 160 | to use `nix develop`. 161 | 162 | ```yaml 163 | # (optional) pre-build the shell separately to avoid skewing the run time of the next 164 | # step and have clear point of failure should the shell fail to build 165 | - name: Pre-build devShell 166 | run: nix build --no-link .#devShells.$(nix eval --impure --raw --expr 'builtins.currentSystem').default 167 | 168 | - name: Run a command with nix develop 169 | shell: 'nix develop -c bash -e {0}' 170 | run: echo "hello, pure world!" 171 | ``` 172 | 173 | ### How do I pass environment variables to commands run with `nix develop` or `nix shell`? 174 | 175 | Nix runs commands in a restricted environment by default, called `pure mode`. 176 | In pure mode, environment variables are not passed through to improve the reproducibility of the shell. 177 | 178 | You can use the `--keep / -k` flag to keep certain environment variables: 179 | 180 | ```yaml 181 | - name: Run a command with nix develop 182 | run: nix develop --ignore-environment --keep MY_ENV_VAR --command echo $MY_ENV_VAR 183 | env: 184 | MY_ENV_VAR: "hello world" 185 | ``` 186 | 187 | Or you can disable pure mode entirely with the `--impure` flag: 188 | 189 | ``` 190 | nix develop --impure 191 | ``` 192 | 193 | ### How do I pass AWS credentials to the Nix daemon? 194 | 195 | In multi-user mode, Nix commands that operate on the Nix store are forwarded to a privileged daemon. This daemon runs in a separate context from your GitHub Actions workflow and cannot access the workflow's environment variables. Consequently, any secrets or credentials defined in your workflow environment will not be available to Nix operations that require store access. 196 | 197 | There are two ways to pass AWS credentials to the Nix daemon: 198 | 199 | - Configure a default profile using the AWS CLI 200 | - Install Nix in single-user mode 201 | 202 | #### Configure a default profile using the AWS CLI 203 | 204 | The Nix daemon supports reading AWS credentials from the `~/.aws/credentials` file. 205 | 206 | We can use the AWS CLI to configure a default profile using short-lived credentials fetched using OIDC: 207 | 208 | ```yaml 209 | job: 210 | build: 211 | runs-on: ubuntu-latest 212 | # Required permissions to request AWS credentials 213 | permissions: 214 | id-token: write 215 | contents: read 216 | steps: 217 | - uses: actions/checkout@v5 218 | - uses: cachix/install-nix-action@v31 219 | - name: Assume AWS Role 220 | uses: aws-actions/configure-aws-credentials@v5.0.0 221 | with: 222 | aws-region: us-east-1 223 | role-to-assume: arn:aws-cn:iam::123456789100:role/my-github-actions-role 224 | - name: Make AWS Credentials accessible to nix-daemon 225 | run: | 226 | sudo -i aws configure set aws_access_key_id "${AWS_ACCESS_KEY_ID}" 227 | sudo -i aws configure set aws_secret_access_key "${AWS_SECRET_ACCESS_KEY}" 228 | sudo -i aws configure set aws_session_token "${AWS_SESSION_TOKEN}" 229 | sudo -i aws configure set region "${AWS_REGION}" 230 | ``` 231 | 232 | #### Install Nix in single-user mode 233 | 234 | In some environments it may be possible to install Nix in single-user mode by passing the `--no-daemon` flag to the installer. 235 | This mode is normally used on platforms without an init system, like systemd, and in containerized environments with a single user that can own the entire Nix store. 236 | 237 | This approach is more generic as it allows passing environment variables directly to Nix, including secrets, proxy settings, and other configuration options. 238 | 239 | However, it may not be suitable for all environments. [Consult the Nix manual](https://nix.dev/manual/nix/latest/installation/nix-security) for the latest restrictions and differences between the two modes. 240 | 241 | For example, single-user mode is currently supported on hosted Linux GitHub runners, like `ubuntu-latest`. 242 | It is not supported on macOS runners, like `macos-latest`. 243 | 244 | ```yaml 245 | - uses: cachix/install-nix-action@v31 246 | with: 247 | install_options: --no-daemon 248 | ``` 249 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --- 204 | 205 | The MIT License (MIT) 206 | 207 | Copyright (c) 2018 GitHub, Inc. and contributors 208 | 209 | Permission is hereby granted, free of charge, to any person obtaining a copy 210 | of this software and associated documentation files (the "Software"), to deal 211 | in the Software without restriction, including without limitation the rights 212 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 213 | copies of the Software, and to permit persons to whom the Software is 214 | furnished to do so, subject to the following conditions: 215 | 216 | The above copyright notice and this permission notice shall be included in 217 | all copies or substantial portions of the Software. 218 | 219 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 220 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 221 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 222 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 223 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 224 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 225 | THE SOFTWARE. --------------------------------------------------------------------------------