Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/actions/install-nix-action/action.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/act-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Act Test

on:
workflow_dispatch:

jobs:
test-release:
name: Test Release Mode
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix from latest release
uses: ./
with:
no-init: true
add-channel: true

- name: Verify Nix installation
run: |
echo "Checking Nix is available..."
which nix
nix --version

echo "Testing nix run command..."
nix run nixpkgs#hello

echo "Testing nix-env install..."
nix-env --install hello
hello
nix-env --uninstall hello
53 changes: 41 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ jobs:
uses: actions/checkout@v4

- name: Install Nix
uses: ./.github/actions/install-nix-action
uses: ./
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}


- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: nix-installer
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Build the installer
run: |
if [[ $RUNNER_OS == "Linux" ]]; then
Expand Down Expand Up @@ -77,9 +84,16 @@ jobs:
check-outdated: false # PRs shouldn't fail because main's nixpkgs is out of date

- name: Install Nix
uses: ./.github/actions/install-nix-action
uses: ./
with:
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: nix-installer
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Check rustfmt
run: nix develop --command check-rustfmt
Expand Down Expand Up @@ -146,13 +160,15 @@ jobs:
fi

- name: Initial install
uses: ./.github/actions/install-nix-action
uses: ./
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
dogfood: true
dogfood-path: ${{ steps.download-installer.outputs.download-path }}
use-cache: false
no-init: ${{ matrix.no-init }}
add-channel: true
verbosity: 2
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: Ensure daemon was not configured with init
if: ${{ matrix.no-init != '' }}
Expand Down Expand Up @@ -191,13 +207,15 @@ jobs:
fi

- name: Repeated install
uses: ./.github/actions/install-nix-action
uses: ./
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
dogfood: true
dogfood-path: ${{ steps.download-installer.outputs.download-path }}
use-cache: false
no-init: ${{ matrix.no-init }}
add-channel: true
verbosity: 2
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: echo $PATH
run: echo "$PATH"
Expand All @@ -206,6 +224,8 @@ jobs:
- name: Test installation
if: ${{ matrix.no-init == '' }}
run: |
set -x
echo $PATH
nix-shell -p hello --command hello
nix-env --install hello
hello
Expand Down Expand Up @@ -276,11 +296,20 @@ jobs:
find "$INSTALL_ROOT" -type f -exec chmod +x {} +

- name: Initial install
uses: ./.github/actions/install-nix-action
uses: ./
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
dogfood: true
dogfood-path: ${{ steps.download-installer.outputs.download-path }}
add-channel: true
verbosity: 2
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: nix-installer
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- run: nix flake check -L
- run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
- name: Install Nix
uses: ./
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: nix-installer
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Create draft release
# The script also depends on gh and git but those are both pre-installed on the runner
run: nix run --inputs-from .# nixpkgs#python3 -- assemble_installer.py "${{ github.event.inputs.testing_hydra_eval_id }}"
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: ./.github/actions/install-nix-action
uses: ./
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
cachix-authtoken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: nix-installer
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Check flake
uses: DeterminateSystems/flake-checker-action@main
- name: Update flake.lock
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,31 @@ podman rmi $IMAGE
With some container tools, such as [Docker], you can omit `sandbox = false`.
Omitting this will negatively impact compatibility with container tools like [Podman].

### In GitHub Actions

This repository provides a GitHub Action for installing Nix in CI workflows.

**Basic usage:**
```yaml
- uses: NixOS/experimental-nix-installer@main
```

**Install specific version:**
```yaml
- uses: NixOS/experimental-nix-installer@main
with:
installer-version: v3.11.3-experimental-prerelease
```

**No-init mode (for containers):**
```yaml
- uses: NixOS/experimental-nix-installer@main
with:
no-init: true
```

See the [action inputs](action.yml) for all available options.

### In WSL2

We **strongly recommend** first [enabling systemd][enabling-systemd] and then installing Nix as normal:
Expand Down
Loading