Skip to content

magic-nix-cache-action fails on self-hosted GitHub Actions runners due to missing XZ dependency. #152

Description

@rorychatterton

Problem:

magic-nix-cache-action fails on self-hosted GitHub Actions runners due to missing XZ dependency.

Sample logs:

Run DeterminateSystems/magic-nix-cache-action@9934a5f127967bcd92e99961e365730ba57253de
/usr/bin/sudo mkdir -p /var/lib/determinate
Downloading magic-nix-cache for ARM64-Linux
Error: Error: Command failed: cat "/home/runner/_work/_temp/magic-nix-cache-03fc6981-0b57-4628-a34f-698c88478fbc" | xz -d | nix-store --import
/bin/sh: 1: xz: not found
error: unexpected end-of-file

Root Cause:

The default self-hosted runner image (from https://github.com/actions/runner) is minimal compared to GitHub's cloud-hosted runners. This minimal image lacks XZ utils, which the action requires.

This particularly affects users of Actions Runner Controller (ARC), GitHub's recommended Kubernetes-based autoscaling solution.

Current Workaround:

Installing XZ via apt at the start of each workflow, which is inefficient and adds overhead to every run.

Proposed Solution:

  • Add automatic XZ detection and installation to magic-nix-cache-action itself, or:
  • Document the intended workflow for determinate nix on self-hosted Github runners.

Discord discussion

https://discord.com/channels/1116012109709463613/1127949914077417564/1440217118854615223

Image Contents

# Check which decompression tools exist
nix:~  % docker run --rm ghcr.io/actions/actions-runner:latest bash -c "which tar gzip gunzip bzip2 bunzip2 xz unxz zstd 7z 2>/dev/null | sort"
/usr/bin/gunzip
/usr/bin/gzip
/usr/bin/tar

# Check which libs are installed
nix:~  % docker run --rm ghcr.io/actions/actions-runner:latest dpkg -l | grep -iE "zstd|bzip|p7zip|xz-utils"
ii  libzstd1:arm64               1.4.8+dfsg-3build1                      arm64        fast lossless compression algorithm

# Check what OS this is
nix:~  % docker run --rm ghcr.io/actions/actions-runner:latest cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions