Skip to content

CI: Travis: add update of Nix packages #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,37 @@ before_script:
- sudo mount -o remount,exec,size=4G,mode=755 /run/user || true
- sudo mkdir -p /etc/nix
- echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf
#
# NOTE: Update Nix and Nix packages, Cachix requires that
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then nix upgrade-nix; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo nix upgrade-nix; fi
#
# NOTE: macOS service restart
- sudo launchctl kickstart -k system/org.nixos.nix-daemon || true
# HACK: Because Nix can not update its daemon itself between 2.0 -> 2.2:
# 1. https://github.com/NixOS/nix/issues/3125#issuecomment-539667327
# 2. https://github.com/NixOS/nix/issues/3125#issuecomment-539771768
# Since Nix on macOS has problems restarting the service:
# Force the real disable, get target file from the symlink, unlink symlink, copy file, and reload service
- |
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then true && \
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \
export NIX_SERVICE_FILE=$(readlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist) && \
sudo unlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \
sudo cp -f "$NIX_SERVICE_FILE" /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \
sudo launchctl kickstart -k system/org.nixos.nix-daemon && \
true; fi

script:
#
#
# NOTE: Install Cachix client using Nix:
- nix-env -iA cachix -f https://cachix.org/api/v1/install
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then nix-env -iA cachix -f https://cachix.org/api/v1/install; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo nix-env -iA cachix -f https://cachix.org/api/v1/install; fi
- cachix use "$name"
# NOTE: If key is set - use Cachix push, else - proceed without it
- if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$name" --watch-store& fi
# NOTE: Brush timeout for previous daemon to start
- sleep 2
#
#
# NOTE: Normal GHC build
Expand Down