mirror of
https://github.com/cachix/install-nix-action.git
synced 2024-11-22 00:20:53 +00:00
allow skipping channel installation
This commit is contained in:
parent
642cfa0200
commit
10a7d51bce
3 changed files with 30 additions and 7 deletions
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
@ -3,7 +3,23 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
simple-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: yarn install --frozen-lockfile
|
||||||
|
- run: yarn build
|
||||||
|
- name: Install Nix
|
||||||
|
uses: ./
|
||||||
|
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||||
|
- run: cat /etc/nix/nix.conf
|
||||||
|
# cachix should be available and be able to configure a cache
|
||||||
|
- run: cachix use cachix
|
||||||
|
- run: nix-build test.nix
|
||||||
|
no-channel:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
@ -15,9 +31,6 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
install_url: https://static.domenkozar.com/install-2.3.5-pre
|
skip_adding_nixpkgs_channel: true
|
||||||
- run: nix-env -iA cachix -f https://github.com/NixOS/nixpkgs/tarball/ab5863afada3c1b50fc43bf774b75ea71b287cde
|
- run: nix-build test.nix && exit 1 || echo "OK"
|
||||||
- run: cat /etc/nix/nix.conf
|
- run: NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/tarball/ab5863afada3c1b50fc43bf774b75ea71b287cde nix-build test.nix
|
||||||
# cachix should be available and be able to configure a cache
|
|
||||||
- run: cachix use cachix
|
|
||||||
- run: nix-build test.nix
|
|
|
@ -4,6 +4,8 @@ author: 'Domen Kožar'
|
||||||
inputs:
|
inputs:
|
||||||
install_url:
|
install_url:
|
||||||
description: 'Installation URL that will contain a script to install Nix'
|
description: 'Installation URL that will contain a script to install Nix'
|
||||||
|
skip_adding_nixpkgs_channel:
|
||||||
|
description: 'Skip adding nixpkgs-unstable channel'
|
||||||
branding:
|
branding:
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
icon: 'sun'
|
icon: 'sun'
|
||||||
|
|
|
@ -6,8 +6,14 @@ sudo sh -c 'echo max-jobs = auto >> /tmp/nix.conf'
|
||||||
# Allow binary caches for runner user
|
# Allow binary caches for runner user
|
||||||
sudo sh -c 'echo trusted-users = root runner >> /tmp/nix.conf'
|
sudo sh -c 'echo trusted-users = root runner >> /tmp/nix.conf'
|
||||||
|
|
||||||
sh <(curl -L ${INPUT_INSTALL_URL:-https://nixos.org/nix/install}) \
|
if [[ $INPUT_SKIP_ADDING_NIXPKGS_CHANNEL = "true" ]]; then
|
||||||
--daemon --daemon-user-count 4 --nix-extra-conf-file /tmp/nix.conf --darwin-use-unencrypted-nix-store-volume
|
extra_cmd=--no-channel-add
|
||||||
|
else
|
||||||
|
extra_cmd=
|
||||||
|
fi
|
||||||
|
|
||||||
|
sh <(curl -L ${INPUT_INSTALL_URL:-https://static.domenkozar.com/install-2.3.5-pre}) \
|
||||||
|
--daemon --daemon-user-count 4 --nix-extra-conf-file /tmp/nix.conf --darwin-use-unencrypted-nix-store-volume $extra_cmd
|
||||||
|
|
||||||
if [[ $OSTYPE =~ darwin ]]; then
|
if [[ $OSTYPE =~ darwin ]]; then
|
||||||
# Disable spotlight indexing of /nix to speed up performance
|
# Disable spotlight indexing of /nix to speed up performance
|
||||||
|
@ -23,4 +29,6 @@ fi
|
||||||
# Set paths
|
# Set paths
|
||||||
echo "::add-path::/nix/var/nix/profiles/per-user/runner/profile/bin"
|
echo "::add-path::/nix/var/nix/profiles/per-user/runner/profile/bin"
|
||||||
echo "::add-path::/nix/var/nix/profiles/default/bin"
|
echo "::add-path::/nix/var/nix/profiles/default/bin"
|
||||||
|
if [[ $INPUT_SKIP_ADDING_NIXPKGS_CHANNEL != "true" ]]; then
|
||||||
echo "::set-env name=NIX_PATH::/nix/var/nix/profiles/per-user/root/channels"
|
echo "::set-env name=NIX_PATH::/nix/var/nix/profiles/per-user/root/channels"
|
||||||
|
fi
|
Loading…
Reference in a new issue