From e2acb8f82a7de9a3353cfe54e9bf2dcb7f0a7db9 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Mon, 15 Jan 2018 01:14:57 +0100 Subject: [PATCH] uninstaller: run on travis --- .travis.yml | 2 ++ pkgs/darwin-uninstaller/configuration.nix | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05355440..8c501e4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,11 @@ matrix: - nix-build ./release.nix -I darwin=. -A examples.simple - nix-build ./release.nix -I darwin=. -A tests - yes | nix-shell -A installer + - yes | nix-shell -A uninstaller - os: osx osx_image: xcode7.3 # 10.11 script: - nix-build ./release.nix -I darwin=. -A examples.simple - nix-build ./release.nix -I darwin=. -A tests - yes | nix-shell -A installer + - yes | nix-shell -A uninstaller diff --git a/pkgs/darwin-uninstaller/configuration.nix b/pkgs/darwin-uninstaller/configuration.nix index a9d352c4..ef8169e4 100644 --- a/pkgs/darwin-uninstaller/configuration.nix +++ b/pkgs/darwin-uninstaller/configuration.nix @@ -21,9 +21,12 @@ with lib; system.activationScripts.postActivation.text = mkAfter '' if test -O /nix/store; then - sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist || true - sudo cp /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist - sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist + l=$(readlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist) || true + if test "$l" != "/nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist"; then + sudo launchctl unload -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist 2> /dev/null || true + sudo ln -sfn /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist + sudo launchctl load -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist + fi if ! grep -q etc/profile.d/nix-daemon.sh /etc/bashrc; then echo >&2 "Found no nix-daemon.sh reference in /etc/bashrc"