Use remote action (#185)
* Use remote action * Use nix installer everywhere * Update README.md * Fixup tag used * Fixups
This commit is contained in:
parent
10c6cfac7e
commit
cf178bb0ef
36
.github/workflows/ci.yml
vendored
36
.github/workflows/ci.yml
vendored
|
@ -11,10 +11,10 @@ jobs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: cachix/install-nix-action@v17
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
extra_nix_config: |
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Cache lint store (x86_64-linux)
|
- name: Cache lint store (x86_64-linux)
|
||||||
id: lint-store-x86_64-linux
|
id: lint-store-x86_64-linux
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
@ -35,10 +35,10 @@ jobs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: cachix/install-nix-action@v17
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
extra_nix_config: |
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Cache build store (x86_64-linux)
|
- name: Cache build store (x86_64-linux)
|
||||||
id: build-store-x86_64-linux
|
id: build-store-x86_64-linux
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
@ -66,10 +66,10 @@ jobs:
|
||||||
needs: build-x86_64-linux # Only run this if the normal checks work, to avoid clogging builders
|
needs: build-x86_64-linux # Only run this if the normal checks work, to avoid clogging builders
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: cachix/install-nix-action@v17
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
extra_nix_config: |
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Cache build store (x86_64-linux)
|
- name: Cache build store (x86_64-linux)
|
||||||
id: build-store-x86_64-linux
|
id: build-store-x86_64-linux
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
@ -100,7 +100,7 @@ jobs:
|
||||||
cp nix-installer.sh install-root/nix-installer.sh
|
cp nix-installer.sh install-root/nix-installer.sh
|
||||||
mv nix-installer install-root/nix-installer-x86_64-linux
|
mv nix-installer install-root/nix-installer-x86_64-linux
|
||||||
- name: Initial install
|
- name: Initial install
|
||||||
uses: ./
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
local-root: install-root/
|
local-root: install-root/
|
||||||
logger: pretty
|
logger: pretty
|
||||||
|
@ -129,7 +129,7 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Repeated install
|
- name: Repeated install
|
||||||
uses: ./
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
local-root: install-root/
|
local-root: install-root/
|
||||||
logger: pretty
|
logger: pretty
|
||||||
|
@ -207,7 +207,7 @@ jobs:
|
||||||
sudo chmod +x /bin/steamos-readonly
|
sudo chmod +x /bin/steamos-readonly
|
||||||
sudo useradd -m deck
|
sudo useradd -m deck
|
||||||
- name: Initial install
|
- name: Initial install
|
||||||
uses: ./
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
local-root: install-root/
|
local-root: install-root/
|
||||||
logger: pretty
|
logger: pretty
|
||||||
|
@ -242,7 +242,7 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Repeated install
|
- name: Repeated install
|
||||||
uses: ./
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
local-root: install-root/
|
local-root: install-root/
|
||||||
logger: pretty
|
logger: pretty
|
||||||
|
@ -308,10 +308,10 @@ jobs:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: cachix/install-nix-action@v17
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
extra_nix_config: |
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# Runs clippy as part of the preBuild.
|
# Runs clippy as part of the preBuild.
|
||||||
- name: Build nix-installer
|
- name: Build nix-installer
|
||||||
run: nix build .#packages.x86_64-darwin.nix-installer -L
|
run: nix build .#packages.x86_64-darwin.nix-installer -L
|
||||||
|
@ -339,7 +339,7 @@ jobs:
|
||||||
cp nix-installer.sh install-root/nix-installer.sh
|
cp nix-installer.sh install-root/nix-installer.sh
|
||||||
mv nix-installer install-root/nix-installer-x86_64-darwin
|
mv nix-installer install-root/nix-installer-x86_64-darwin
|
||||||
- name: Initial install
|
- name: Initial install
|
||||||
uses: ./
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
local-root: install-root/
|
local-root: install-root/
|
||||||
logger: pretty
|
logger: pretty
|
||||||
|
@ -356,7 +356,7 @@ jobs:
|
||||||
NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=trace
|
NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=trace
|
||||||
RUST_BACKTRACE: full
|
RUST_BACKTRACE: full
|
||||||
- name: Repeated install
|
- name: Repeated install
|
||||||
uses: ./
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
with:
|
with:
|
||||||
local-root: install-root/
|
local-root: install-root/
|
||||||
logger: pretty
|
logger: pretty
|
||||||
|
|
|
@ -129,7 +129,7 @@ You can remove a `nix-installer`-installed Nix by running
|
||||||
|
|
||||||
## As a Github Action
|
## As a Github Action
|
||||||
|
|
||||||
You can use `nix-installer` as a Github action like so:
|
You can use the [`nix-installer-action`](https://github.com/DeterminateSystems/nix-installer-action) Github Action like so:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
on:
|
on:
|
||||||
|
@ -144,7 +144,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer@main
|
uses: DeterminateSystems/nix-installer-action
|
||||||
with:
|
with:
|
||||||
# Allow the installed Nix to make authenticated Github requests.
|
# Allow the installed Nix to make authenticated Github requests.
|
||||||
# If you skip this, you will likely get rate limited.
|
# If you skip this, you will likely get rate limited.
|
||||||
|
|
200
action.yml
200
action.yml
|
@ -1,200 +0,0 @@
|
||||||
name: Nix Installer
|
|
||||||
branding:
|
|
||||||
icon: 'box'
|
|
||||||
color: 'purple'
|
|
||||||
description: An experimental Nix installer using `nix-install`
|
|
||||||
inputs:
|
|
||||||
planner:
|
|
||||||
description: A planner to use
|
|
||||||
required: false
|
|
||||||
extra-args:
|
|
||||||
description: Extra args to pass to the planner (prefer using structured `with:` arguments unless using a custom planner!)
|
|
||||||
required: false
|
|
||||||
github-token:
|
|
||||||
description: A Github Token so that authenticated requests can be made (set this to `secrets.GITHUB_TOKEN`)
|
|
||||||
channels:
|
|
||||||
description: Channel(s) to add (eg `nixpkgs=https://nixos.org/channels/nixpkgs-unstable`)
|
|
||||||
required: false
|
|
||||||
modify-profile:
|
|
||||||
description: Modify the user profile to automatically load nix
|
|
||||||
required: false
|
|
||||||
nix-build-user-count:
|
|
||||||
description: Number of build users to create
|
|
||||||
required: false
|
|
||||||
nix-build-group-name:
|
|
||||||
description: The Nix build group name
|
|
||||||
required: false
|
|
||||||
nix-build-group-id:
|
|
||||||
description: The Nix build group GID
|
|
||||||
required: false
|
|
||||||
nix-build-user-prefix:
|
|
||||||
description: The Nix build user prefix (user numbers will be postfixed)
|
|
||||||
required: false
|
|
||||||
nix-build-user-base:
|
|
||||||
description: The Nix build user base UID (ascending)
|
|
||||||
required: false
|
|
||||||
nix-package-url:
|
|
||||||
description: The Nix package URL
|
|
||||||
required: false
|
|
||||||
extra-conf:
|
|
||||||
description: Extra configuration lines for `/etc/nix.conf` (includes `access-tokens` with `secrets.GITHUB_TOKEN` automatically if `github-token` is set)
|
|
||||||
required: false
|
|
||||||
mac-encrypt:
|
|
||||||
description: Force encryption on the volume (Mac only)
|
|
||||||
required: false
|
|
||||||
mac-case-sensitive:
|
|
||||||
description: Use a case sensitive volume (Mac only)
|
|
||||||
required: false
|
|
||||||
mac-volume-label:
|
|
||||||
description: The label for the created APFS volume (Mac only)
|
|
||||||
required: false
|
|
||||||
mac-root-disk:
|
|
||||||
description: The root disk of the target (Mac only)
|
|
||||||
required: false
|
|
||||||
nix-installer-url:
|
|
||||||
description: A URL pointing to a `nix-installer.sh` script
|
|
||||||
required: true
|
|
||||||
default: https://install.determinate.systems/nix
|
|
||||||
local-root:
|
|
||||||
description: A local `nix-installer` binary root, overrides the `nix-installer-url` setting (a `nix-installer.sh` should exist, binaries should be named `nix-installer-$ARCH`, eg. `nix-installer-x86_64-linux`)
|
|
||||||
required: false
|
|
||||||
logger:
|
|
||||||
description: The logger to use for install (eg. `pretty`, `json`, `full`, `compact`)
|
|
||||||
required: false
|
|
||||||
log-directives:
|
|
||||||
description: A list of Tracing directives, comma separated, `-`s replaced with `_` (eg. `nix_installer=trace`, see https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
|
|
||||||
required: false
|
|
||||||
backtrace:
|
|
||||||
description: The setting for `RUST_BACKTRACE` (see https://doc.rust-lang.org/std/backtrace/index.html#environment-variables)
|
|
||||||
required: false
|
|
||||||
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Install Nix
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ -n "${{ inputs.channels }}" ]; then
|
|
||||||
export NIX_INSTALLER_CHANNELS=${{ inputs.channels }}
|
|
||||||
echo "Set NIX_INSTALLER_CHANNELS=$NIX_INSTALLER_CHANNELS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.modify-profile }}" ]; then
|
|
||||||
export NIX_INSTALLER_MODIFY_PROFILE=${{ inputs.modify-profile }}
|
|
||||||
echo "Set NIX_INSTALLER_MODIFY_PROFILE=$NIX_INSTALLER_MODIFY_PROFILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.daemon-user-count }}" ]; then
|
|
||||||
export NIX_INSTALLER_NIX_BUILD_USER_COUNT=${{ inputs.nix-build-user-count }}
|
|
||||||
echo "Set NIX_INSTALLER_NIX_BUILD_USER_COUNT=$NIX_INSTALLER_NIX_BUILD_USER_COUNT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.nix-build-group-name }}" ]; then
|
|
||||||
export NIX_INSTALLER_NIX_BUILD_GROUP_NAME=${{ inputs.nix-build-group-name }}
|
|
||||||
echo "Set NIX_INSTALLER_NIX_BUILD_GROUP_NAME=$NIX_INSTALLER_NIX_BUILD_GROUP_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.nix-build-group-id }}" ]; then
|
|
||||||
export NIX_INSTALLER_NIX_BUILD_GROUP_ID=${{ inputs.nix-build-group-id }}
|
|
||||||
echo "Set NIX_INSTALLER_NIX_BUILD_GROUP_ID=$NIX_INSTALLER_NIX_BUILD_GROUP_ID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.nix-build-user-prefix }}" ]; then
|
|
||||||
export NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=${{ inputs.nix-build-user-prefix }}
|
|
||||||
echo "Set NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=$NIX_INSTALLER_NIX_BUILD_USER_ID_BASE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.nix-build-user-base }}" ]; then
|
|
||||||
export NIX_INSTALLER_NIX_BUILD_USER_PREFIX=${{ inputs.nix-build-user-base }}
|
|
||||||
echo "Set NIX_INSTALLER_NIX_BUILD_USER_PREFIX=$NIX_INSTALLER_NIX_BUILD_USER_PREFIX"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.nix-package-url }}" ]; then
|
|
||||||
export NIX_INSTALLER_NIX_PACKAGE_URL=${{ inputs.nix-package-url }}
|
|
||||||
echo "Set NIX_INSTALLER_NIX_PACKAGE_URL=$NIX_INSTALLER_NIX_PACKAGE_URL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export NIX_INSTALLER_EXTRA_CONF_FILE=/tmp/extra-nix-config
|
|
||||||
touch $NIX_INSTALLER_EXTRA_CONF_FILE
|
|
||||||
if [ -n "${{ inputs.extra-conf }}" ]; then
|
|
||||||
echo "${{ inputs.extra-conf }}" >> $NIX_INSTALLER_EXTRA_CONF_FILE
|
|
||||||
fi
|
|
||||||
if [ -n "${{ inputs.github-token }}" ]; then
|
|
||||||
echo "access-tokens = github.com=${{ inputs.github-token }}" >> $NIX_INSTALLER_EXTRA_CONF_FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
export NIX_INSTALLER_EXTRA_CONF="$(cat $NIX_INSTALLER_EXTRA_CONF_FILE)"
|
|
||||||
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.mac-encrypt }}" ]; then
|
|
||||||
export NIX_INSTALLER_ENCRYPT=${{ inputs.mac-encrypt }}
|
|
||||||
echo "Set NIX_INSTALLER_ENCRYPT=$NIX_INSTALLER_ENCRYPT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.mac-case-sensitive }}" ]; then
|
|
||||||
export NIX_INSTALLER_CASE_SENSITIVE=${{ inputs.mac-case-sensitive }}
|
|
||||||
echo "Set NIX_INSTALLER_CASE_SENSITIVE=$NIX_INSTALLER_CASE_SENSITIVE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.mac-volume-label }}" ]; then
|
|
||||||
export NIX_INSTALLER_VOLUME_LABEL=${{ inputs.mac-volume-label }}
|
|
||||||
echo "Set NIX_INSTALLER_VOLUME_LABEL=$NIX_INSTALLER_VOLUME_LABEL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.mac-root-disk }}" ]; then
|
|
||||||
export NIX_INSTALLER_ROOT_DISK=${{ inputs.mac-root-disk }}
|
|
||||||
echo "Set NIX_INSTALLER_ROOT_DISK=$NIX_INSTALLER_ROOT_DISK"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.local-root }}" ]; then
|
|
||||||
if [ "$RUNNER_OS" == "macOS" ]; then
|
|
||||||
export PYTHON="python3"
|
|
||||||
else
|
|
||||||
export PYTHON="python"
|
|
||||||
fi
|
|
||||||
$PYTHON -m http.server --directory ${{ inputs.local-root }} --bind 0.0.0.0 8000 &
|
|
||||||
export HTTP_PID=$!
|
|
||||||
echo "Started simple http server for ${{ inputs.local-root }} on 0.0.0.0:8000"
|
|
||||||
while (! (: </dev/tcp/localhost/8000) &> /dev/null); do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
export NIX_INSTALLER_FORCE_ALLOW_HTTP="1"
|
|
||||||
echo "Set NIX_INSTALLER_FORCE_ALLOW_HTTP=$NIX_INSTALLER_FORCE_ALLOW_HTTP"
|
|
||||||
export NIX_INSTALLER_URL=0.0.0.0:8000/nix-installer.sh
|
|
||||||
echo "Set NIX_INSTALLER_URL=$NIX_INSTALLER_URL"
|
|
||||||
export NIX_INSTALLER_BINARY_ROOT=http://0.0.0.0:8000/
|
|
||||||
echo "Set NIX_INSTALLER_BINARY_ROOT=$NIX_INSTALLER_BINARY_ROOT"
|
|
||||||
export NIX_INSTALLER_FORCE_ALLOW_HTTP=1
|
|
||||||
echo "Set NIX_INSTALLER_FORCE_ALLOW_HTTP=$NIX_INSTALLER_FORCE_ALLOW_HTTP"
|
|
||||||
else
|
|
||||||
export NIX_INSTALLER_URL=${{ inputs.nix-installer-url }}
|
|
||||||
echo "Set NIX_INSTALLER_URL=$NIX_INSTALLER_URL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.logger }}" ]; then
|
|
||||||
export NIX_INSTALLER_LOGGER=${{ inputs.logger }}
|
|
||||||
echo "Set NIX_INSTALLER_LOGGER=$NIX_INSTALLER_LOGGER"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.log-directives }}" ]; then
|
|
||||||
export NIX_INSTALLER_LOG_DIRECTIVES=${{ inputs.log-directives }}
|
|
||||||
echo "Set NIX_INSTALLER_LOG_DIRECTIVES=$NIX_INSTALLER_LOG_DIRECTIVES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${{ inputs.backtrace }}" ]; then
|
|
||||||
export RUST_BACKTRACE=${{ inputs.backtrace }}
|
|
||||||
echo "Set RUST_BACKTRACE=$RUST_BACKTRACE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export NIX_INSTALLER_NO_CONFIRM=true
|
|
||||||
echo "Set NIX_INSTALLER_NO_CONFIRM=$NIX_INSTALLER_NO_CONFIRM"
|
|
||||||
|
|
||||||
curl --retry 20 -L $NIX_INSTALLER_URL | sh -s -- install ${{ inputs.planner }} ${{ inputs.extra-args }}
|
|
||||||
|
|
||||||
if [ -n "$HTTP_PID" ]; then
|
|
||||||
kill $HTTP_PID
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue