mirror of
https://github.com/cachix/install-nix-action.git
synced 2024-11-22 08:30:51 +00:00
commit
be4cef7b77
1 changed files with 7 additions and 7 deletions
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if type -p nix &>/dev/null ; then
|
if nix_path="$(type -p nix)" ; then
|
||||||
echo "Aborting: Nix is already installed at $(type -p nix)"
|
echo "Aborting: Nix is already installed at ${nix_path}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ trap 'rm -rf "$workdir"' EXIT
|
||||||
|
|
||||||
# Configure Nix
|
# Configure Nix
|
||||||
add_config() {
|
add_config() {
|
||||||
echo "$1" | tee -a "$workdir/nix.conf" >/dev/null
|
echo "$1" >> "$workdir/nix.conf"
|
||||||
}
|
}
|
||||||
# Set jobs to number of cores
|
# Set jobs to number of cores
|
||||||
add_config "max-jobs = auto"
|
add_config "max-jobs = auto"
|
||||||
|
@ -28,7 +28,7 @@ elif [[ -n "${GITHUB_TOKEN:-}" ]]; then
|
||||||
add_config "access-tokens = github.com=$GITHUB_TOKEN"
|
add_config "access-tokens = github.com=$GITHUB_TOKEN"
|
||||||
fi
|
fi
|
||||||
# Append extra nix configuration if provided
|
# Append extra nix configuration if provided
|
||||||
if [[ $INPUT_EXTRA_NIX_CONFIG != "" ]]; then
|
if [[ -n "${INPUT_EXTRA_NIX_CONFIG:-}" ]]; then
|
||||||
add_config "$INPUT_EXTRA_NIX_CONFIG"
|
add_config "$INPUT_EXTRA_NIX_CONFIG"
|
||||||
fi
|
fi
|
||||||
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then
|
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then
|
||||||
|
@ -54,10 +54,10 @@ else
|
||||||
add_config "build-users-group ="
|
add_config "build-users-group ="
|
||||||
sudo mkdir -p /etc/nix
|
sudo mkdir -p /etc/nix
|
||||||
sudo chmod 0755 /etc/nix
|
sudo chmod 0755 /etc/nix
|
||||||
sudo cp $workdir/nix.conf /etc/nix/nix.conf
|
sudo cp "$workdir/nix.conf" /etc/nix/nix.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $INPUT_INSTALL_OPTIONS != "" ]]; then
|
if [[ -n "${INPUT_INSTALL_OPTIONS:-}" ]]; then
|
||||||
IFS=' ' read -r -a extra_installer_options <<< "$INPUT_INSTALL_OPTIONS"
|
IFS=' ' read -r -a extra_installer_options <<< "$INPUT_INSTALL_OPTIONS"
|
||||||
installer_options=("${extra_installer_options[@]}" "${installer_options[@]}")
|
installer_options=("${extra_installer_options[@]}" "${installer_options[@]}")
|
||||||
fi
|
fi
|
||||||
|
@ -91,7 +91,7 @@ echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
|
||||||
# new path for nix 2.14
|
# new path for nix 2.14
|
||||||
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"
|
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
if [[ $INPUT_NIX_PATH != "" ]]; then
|
if [[ -n "${INPUT_NIX_PATH:-}" ]]; then
|
||||||
echo "NIX_PATH=${INPUT_NIX_PATH}" >> "$GITHUB_ENV"
|
echo "NIX_PATH=${INPUT_NIX_PATH}" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue