|
|
@ -19,9 +19,6 @@ add_config() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Set jobs to number of cores
|
|
|
|
# Set jobs to number of cores
|
|
|
|
add_config "max-jobs = auto"
|
|
|
|
add_config "max-jobs = auto"
|
|
|
|
if [[ $OSTYPE =~ darwin ]]; then
|
|
|
|
|
|
|
|
add_config "ssl-cert-file = /etc/ssl/cert.pem"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Allow binary caches for user
|
|
|
|
# Allow binary caches for user
|
|
|
|
add_config "trusted-users = root ${USER:-}"
|
|
|
|
add_config "trusted-users = root ${USER:-}"
|
|
|
|
# Add github access token
|
|
|
|
# Add github access token
|
|
|
@ -35,7 +32,7 @@ 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
|
|
|
|
add_config "experimental-features = nix-command flakes"
|
|
|
|
add_config "experimental-features = nix-command flakes auto-allocate-uids"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Nix installer flags
|
|
|
|
# Nix installer flags
|
|
|
@ -49,8 +46,9 @@ installer_options=(
|
|
|
|
if [[ (! $INPUT_INSTALL_OPTIONS =~ "--no-daemon") && ($OSTYPE =~ darwin || -e /run/systemd/system) ]]; then
|
|
|
|
if [[ (! $INPUT_INSTALL_OPTIONS =~ "--no-daemon") && ($OSTYPE =~ darwin || -e /run/systemd/system) ]]; then
|
|
|
|
installer_options+=(
|
|
|
|
installer_options+=(
|
|
|
|
--daemon
|
|
|
|
--daemon
|
|
|
|
--daemon-user-count "$(python3 -c 'import multiprocessing as mp; print(mp.cpu_count() * 2)')"
|
|
|
|
--daemon-user-count 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
add_config "auto-allocate-uids = true"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# "fix" the following error when running nix*
|
|
|
|
# "fix" the following error when running nix*
|
|
|
|
# error: the group 'nixbld' specified in 'build-users-group' does not exist
|
|
|
|
# error: the group 'nixbld' specified in 'build-users-group' does not exist
|
|
|
@ -69,7 +67,7 @@ echo "installer options: ${installer_options[*]}"
|
|
|
|
|
|
|
|
|
|
|
|
# There is --retry-on-errors, but only newer curl versions support that
|
|
|
|
# There is --retry-on-errors, but only newer curl versions support that
|
|
|
|
curl_retries=5
|
|
|
|
curl_retries=5
|
|
|
|
while ! curl -sS -o "$workdir/install" -v --fail -L "${INPUT_INSTALL_URL:-https://releases.nixos.org/nix/nix-2.16.1/install}"
|
|
|
|
while ! curl -sS -o "$workdir/install" -v --fail -L "${INPUT_INSTALL_URL:-https://releases.nixos.org/nix/nix-2.15.1/install}"
|
|
|
|
do
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
sleep 1
|
|
|
|
((curl_retries--))
|
|
|
|
((curl_retries--))
|
|
|
@ -81,6 +79,14 @@ done
|
|
|
|
|
|
|
|
|
|
|
|
sh "$workdir/install" "${installer_options[@]}"
|
|
|
|
sh "$workdir/install" "${installer_options[@]}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $OSTYPE =~ darwin ]]; then
|
|
|
|
|
|
|
|
# macOS needs certificates hints
|
|
|
|
|
|
|
|
cert_file=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
|
|
|
|
|
|
|
|
echo "NIX_SSL_CERT_FILE=$cert_file" >> "$GITHUB_ENV"
|
|
|
|
|
|
|
|
export NIX_SSL_CERT_FILE=$cert_file
|
|
|
|
|
|
|
|
sudo launchctl setenv NIX_SSL_CERT_FILE "$cert_file"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Set paths
|
|
|
|
# Set paths
|
|
|
|
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
|
|
|
|
# new path for nix 2.14
|
|
|
|
# new path for nix 2.14
|
|
|
|