-
Notifications
You must be signed in to change notification settings - Fork 76
/
install-nix.sh
executable file
·34 lines (25 loc) · 1.1 KB
/
install-nix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -euo pipefail
export here=$(dirname "${BASH_SOURCE[0]}")
if [[ $OSTYPE =~ darwin ]]; then
# Catalina workaround https://github.com/NixOS/nix/issues/2925
$here/create-darwin-volume.sh
# Disable spotlight indexing of /nix to speed up performance
sudo mdutil -i off /nix
fi
# Set jobs to number of cores
sudo sh -c 'echo max-jobs = auto >> /tmp/nix.conf'
# Allow binary caches for runner user
sudo sh -c 'echo trusted-users = root runner >> /tmp/nix.conf'
sh <(curl -L ${INPUT_INSTALL_URL:-https://nixos.org/nix/install}) --daemon --daemon-user-count 4 --nix-extra-conf-file /tmp/nix.conf
# macOS needs certificates hints
if [[ $OSTYPE =~ darwin ]]; then
cert_file=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
echo "::set-env name=NIX_SSL_CERT_FILE::$cert_file"
export NIX_SSL_CERT_FILE=$cert_file
sudo launchctl setenv NIX_SSL_CERT_FILE "$cert_file"
fi
# Set paths
echo "::add-path::/nix/var/nix/profiles/per-user/runner/profile/bin"
echo "::add-path::/nix/var/nix/profiles/default/bin"
echo "::set-env name=NIX_PATH::/nix/var/nix/profiles/per-user/root/channels"