Skip to content

Update from upstream #126

Update from upstream

Update from upstream #126

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
permissions:
contents: "read"
jobs:
build:
name: Build (${{ matrix.system }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
system: x86_64-linux
- os: ubuntu-24.04-arm
system: aarch64-linux
- os: macos-15-intel
system: x86_64-darwin
- os: macos-15
system: aarch64-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: ./.github/actions/install-nix-action
- name: Build the installer
run: |
if [[ $RUNNER_OS == "Linux" ]]; then
ATTR="nix-installer-static"
elif [[ $RUNNER_OS == "macOS" ]]; then
ATTR="nix-installer"
else
echo "error: '$RUNNER_OS' is an unsupported operating system"
fi
nix build ".#$ATTR" -L
- name: Create installer bundle
run: |
mkdir install-root/
cp nix-installer.sh install-root/nix-installer.sh
cp result/bin/nix-installer install-root/nix-installer-${{ matrix.system }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nix-installer-${{ matrix.system }}
path: install-root/
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Nixpkgs input
uses: DeterminateSystems/flake-checker-action@main
with:
fail-mode: true
check-outdated: false # PRs shouldn't fail because main's nixpkgs is out of date
- name: Install Nix
uses: ./.github/actions/install-nix-action
- name: Check rustfmt
run: nix develop --command check-rustfmt
- name: Check Clippy
run: nix develop --command check-clippy
- name: Check Spelling
run: nix develop --command check-spelling
- name: Check nixpkgs-fmt formatting
run: nix develop --command check-nixpkgs-fmt
- name: Check EditorConfig conformance
run: nix develop --command check-editorconfig
- name: Shell check for nix-installer.sh
run: nix develop --command shellcheck ./nix-installer.sh
run:
name: Run (${{ matrix.system }}${{ matrix.no-init && ', no init' || '' }})
needs: [ build ]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
system: x86_64-linux
- os: ubuntu-24.04
system: x86_64-linux
no-init: true
- os: ubuntu-24.04-arm
system: aarch64-linux
- os: macos-15-intel
system: x86_64-darwin
- os: macos-15
system: aarch64-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifact
id: download-installer
uses: actions/download-artifact@v5
with:
name: nix-installer-${{ matrix.system }}
path: install-root/
- name: Set installer components as executable
env:
INSTALL_ROOT: ${{ steps.download-installer.outputs.download-path }}
run: |
find "$INSTALL_ROOT" -type f -exec chmod +x {} +
- name: Install dependencies
run: |
if [[ $RUNNER_OS == "Linux" ]]; then
sudo apt install fish zsh
elif [[ $RUNNER_OS = "macOS" ]]; then
brew install coreutils fish
else
echo "Unsupported runner operating system: $RUNNER_OS"
exit 1
fi
- name: Initial install
uses: ./.github/actions/install-nix-action
with:
dogfood: true
dogfood-path: ${{ steps.download-installer.outputs.download-path }}
use-cache: false
no-init: ${{ matrix.no-init }}
- name: Ensure daemon was not configured with init
if: ${{ matrix.no-init != '' }}
run: |
if systemctl is-active nix-daemon.socket; then
echo "nix-daemon.socket was running"
exit 1
fi
if systemctl is-active nix-daemon.service; then
echo "nix-daemon.service was running"
exit 1
fi
- name: Initial uninstall (without a `nix run` first)
run: sudo -E /nix/nix-installer uninstall
env:
NIX_INSTALLER_NO_CONFIRM: true
NIX_INSTALLER_LOGGER: pretty
NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=debug
RUST_BACKTRACE: full
- name: Ensure `nix` is removed
if: ${{ runner.os == 'Linux' }}
run: |
if systemctl is-active nix-daemon.socket; then
echo "nix-daemon.socket was still running"
exit 1
fi
if systemctl is-active nix-daemon.service; then
echo "nix-daemon.service was still running"
exit 1
fi
if [ -e /nix ]; then
echo "/nix exists"
exit 1
fi
- name: Repeated install
uses: ./.github/actions/install-nix-action
with:
dogfood: true
dogfood-path: ${{ steps.download-installer.outputs.download-path }}
use-cache: false
no-init: ${{ matrix.no-init }}
- name: echo $PATH
run: echo "$PATH"
# TODO: Find a better way to invoke these commands with `sudo` in the no-init cases
- name: Test installation
if: ${{ matrix.no-init == '' }}
run: |
nix-shell -p hello --command hello
nix-env --install hello
hello
nix-store --gc
nix-shell -p hello --command hello
/nix/nix-installer self-test
- name: Test installation (no init)
if: ${{ matrix.no-init != '' }}
run: |
sudo -i nix-shell -p hello --command hello
sudo -i nix-env --install hello
sudo -i hello
sudo -i nix-store --gc
sudo -i nix-shell -p hello --command hello
sudo -E /nix/nix-installer self-test
- name: Repeated uninstall
run: sudo -E /nix/nix-installer uninstall
env:
NIX_INSTALLER_NO_CONFIRM: true
NIX_INSTALLER_LOGGER: pretty
NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=debug
RUST_BACKTRACE: full
- name: Ensure `nix` is removed
if: ${{ runner.os == 'Linux' }}
run: |
if systemctl is-active nix-daemon.socket; then
echo "nix-daemon.socket was still running"
exit 1
fi
if systemctl is-active nix-daemon.service; then
echo "nix-daemon.service was still running"
exit 1
fi
if [ -e /nix ]; then
echo "/nix exists"
exit 1
fi
release-checks:
name: Run release checks
if: ${{ contains(github.ref, 'release-') || contains(github.head_ref, 'release-') }}
needs: [build, lints]
runs-on: ubuntu-24.04
env:
SYSTEM: x86_64-linux
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore Github cache artifacts
id: download-installer
uses: actions/download-artifact@v5
with:
name: nix-installer-${{ env.SYSTEM }}
path: install-root/
- name: Set installer components as executable
env:
INSTALL_ROOT: ${{ steps.download-installer.outputs.download-path }}
run: |
find "$INSTALL_ROOT" -type f -exec chmod +x {} +
- name: Initial install
uses: ./.github/actions/install-nix-action
with:
dogfood: true
dogfood-path: ${{ steps.download-installer.outputs.download-path }}
- run: nix flake check -L
- run: |
nix build \
-L --tarball-ttl 0 --keep-going \
.#hydraJobs.container-test.all.x86_64-linux.all \
.#hydraJobs.vm-test.all.x86_64-linux.all