From 2cd3446f22816981ac6fb00e6327b640231eed1c Mon Sep 17 00:00:00 2001 From: John Lago <750845+Lagoja@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:26:55 -0800 Subject: [PATCH 1/3] Add nix-package-url input to support custom Nix versions Adds a new optional input 'nix-package-url' that allows users to specify a URL to a Nix package tarball for installing a specific Nix version. The URL is passed to the experimental installer via the NIX_INSTALLER_NIX_PACKAGE_URL environment variable. Co-Authored-By: Claude Sonnet 4.5 --- action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 60773fc..4fa41c3 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,10 @@ inputs: extra-nix-config: description: 'Gets appended to `nix.conf` if passed' default: '' + nix-package-url: + description: 'URL to a Nix package tarball to install a specific Nix version' + required: false + default: '' runs: using: "composite" @@ -156,6 +160,7 @@ runs: NIX_INSTALLER_START_DAEMON: true NIX_INSTALLER_TRUST_RUNNER_USER: true NIX_INSTALLER_CHANNELS: nixpkgs=https://nixos.org/channels/nixpkgs-unstable + NIX_INSTALLER_NIX_PACKAGE_URL: ${{ inputs.nix-package-url }} run: | echo "Installing Nix using experimental installer..." From ca6800f71b49c65c086f85668ac8d8d94ca39350 Mon Sep 17 00:00:00 2001 From: John Lago <750845+Lagoja@users.noreply.github.com> Date: Tue, 10 Feb 2026 22:55:28 -0800 Subject: [PATCH 2/3] Add test matrix for nix-package-url feature Tests the new nix-package-url input across multiple Nix versions (2.18.0, 2.19.2, 2.24.7, 2.30.2) and operating systems (Ubuntu, macOS). Each test verifies the correct Nix version is installed and runs basic devbox commands. Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/test.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 358cd3b..6f32175 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -108,3 +108,38 @@ jobs: - name: Check nix user-agent-suffix config run: | [[ "$(nix config show user-agent-suffix)" == "test-suffix" ]] + + test-nix-versions: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + nix-version: [2.18.0, 2.19.2, 2.24.7, 2.30.2] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Install devbox with specific Nix version + uses: ./ + with: + project-path: 'testdata' + nix-package-url: https://releases.nixos.org/nix/nix-${{ matrix.nix-version }}/nix-${{ matrix.nix-version }}-${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}-${{ runner.os == 'macOS' && 'darwin' || 'linux' }}.tar.xz + disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}" + - name: Verify Nix version and run devbox commands + run: | + echo "::group::Nix version" + nix --version + installed_version=$(nix --version | awk '{print $3}') + expected_version="${{ matrix.nix-version }}" + if [[ "$installed_version" != "$expected_version" ]]; then + echo "ERROR: Expected Nix version $expected_version, but got $installed_version" + exit 1 + fi + echo "::endgroup::" + echo "::group::Contents of /etc/nix/nix.conf" + cat /etc/nix/nix.conf || true + echo "::endgroup::" + echo "::group::Resolved Nix config" + nix show-config --extra-experimental-features nix-command || true + echo "::endgroup::" + echo "::group::Run devbox commands" + devbox run -- echo "Hello from devbox!" + echo "::endgroup::" From 6cb3dae7276479a9a33969357d2cbb7b0577f3d5 Mon Sep 17 00:00:00 2001 From: John Lago <750845+Lagoja@users.noreply.github.com> Date: Tue, 10 Feb 2026 23:43:52 -0800 Subject: [PATCH 3/3] Fix nix-package-url to pass as command flag instead of env var The experimental Nix installer requires --nix-package-url to be passed as a command-line flag to the install command, not just as an environment variable. Updated the action to build the install command conditionally with the --nix-package-url flag when the input is provided. Co-Authored-By: Claude Sonnet 4.5 --- action.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 4fa41c3..3ad0181 100644 --- a/action.yml +++ b/action.yml @@ -160,21 +160,26 @@ runs: NIX_INSTALLER_START_DAEMON: true NIX_INSTALLER_TRUST_RUNNER_USER: true NIX_INSTALLER_CHANNELS: nixpkgs=https://nixos.org/channels/nixpkgs-unstable - NIX_INSTALLER_NIX_PACKAGE_URL: ${{ inputs.nix-package-url }} run: | echo "Installing Nix using experimental installer..." - + + # Build installer command with optional nix-package-url + INSTALL_ARGS="install --no-confirm" + if [[ -n "${{ inputs.nix-package-url }}" ]]; then + INSTALL_ARGS="$INSTALL_ARGS --nix-package-url ${{ inputs.nix-package-url }}" + fi + # Download and run the experimental installer curl --proto '=https' --tlsv1.2 -sSf -L https://artifacts.nixos.org/experimental-installer | \ - sh -s -- install --no-confirm - + sh -s -- $INSTALL_ARGS + # Source the nix profile to make nix available in current shell if [ -f ~/.nix-profile/etc/profile.d/nix.sh ]; then source ~/.nix-profile/etc/profile.d/nix.sh elif [ -f /etc/profile.d/nix.sh ]; then source /etc/profile.d/nix.sh fi - + # Verify installation nix --version nix-env --version