diff --git a/scripts/install-darwin-multi-user.sh b/scripts/install-darwin-multi-user.sh index 49076bd5c03fa24cbf9afc73f5e7255f7293f1ab..a27be2a43d5a31064cbc30b72be2bdf8a4dc7557 100644 --- a/scripts/install-darwin-multi-user.sh +++ b/scripts/install-darwin-multi-user.sh @@ -37,6 +37,13 @@ poly_service_setup_note() { EOF } +poly_extra_try_me_commands(){ + : +} +poly_extra_setup_instructions(){ + : +} + poly_configure_nix_daemon_service() { _sudo "to set up the nix-daemon as a LaunchDaemon" \ cp -f "/nix/var/nix/profiles/default$PLIST_DEST" "$PLIST_DEST" diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index e5cc4d7ed96ace96d2399b9c9c5e19136b9003ff..54edfe40dc9a91514e472ed3bc85eb935c119cae 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -71,11 +71,9 @@ uninstall_directions() { subheader "Uninstalling nix:" local step=0 - if [ -e /run/systemd/system ] && poly_service_installed_check; then + if poly_service_installed_check; then step=$((step + 1)) poly_service_uninstall_directions "$step" - else - step=$((step + 1)) fi for profile_target in "${PROFILE_TARGETS[@]}"; do @@ -255,40 +253,20 @@ function finish_success { echo "To try again later, run \"sudo -i nix-channel --update nixpkgs\"." fi - if [ -e /run/systemd/system ]; then - cat <<EOF - -Before Nix will work in your existing shells, you'll need to close -them and open them again. Other than that, you should be ready to go. - -Try it! Open a new terminal, and type: - - $ nix-shell -p nix-info --run "nix-info -m" - -Thank you for using this installer. If you have any feedback, don't -hesitate: - -$(contactme) -EOF - else - cat <<EOF + cat <<EOF Before Nix will work in your existing shells, you'll need to close them and open them again. Other than that, you should be ready to go. Try it! Open a new terminal, and type: - - $ sudo nix-daemon +$(poly_extra_try_me_commands) $ nix-shell -p nix-info --run "nix-info -m" - -Additionally, you may want to add nix-daemon to your init-system. - +$(poly_extra_setup_instructions) Thank you for using this installer. If you have any feedback, don't hesitate: $(contactme) EOF - fi } @@ -725,9 +703,7 @@ main() { setup_default_profile place_nix_configuration - if [ -e /run/systemd/system ]; then - poly_configure_nix_daemon_service - fi + poly_configure_nix_daemon_service trap finish_success EXIT } diff --git a/scripts/install-systemd-multi-user.sh b/scripts/install-systemd-multi-user.sh index e0201d53bd78336dfb6e60e61a51cffd9fe1416d..fda5ef6007cff6cdf68631e1e1a603ff54cb3f5c 100755 --- a/scripts/install-systemd-multi-user.sh +++ b/scripts/install-systemd-multi-user.sh @@ -72,24 +72,45 @@ poly_service_setup_note() { EOF } -poly_configure_nix_daemon_service() { - _sudo "to set up the nix-daemon service" \ - systemctl link "/nix/var/nix/profiles/default$SERVICE_SRC" +poly_extra_try_me_commands(){ + if [ -e /run/systemd/system ]; then + : + else + cat <<EOF + $ sudo nix-daemon +EOF + fi +} +poly_extra_setup_instructions(){ + if [ -e /run/systemd/system ]; then + : + else + cat <<EOF +Additionally, you may want to add nix-daemon to your init-system. - _sudo "to set up the nix-daemon socket service" \ - systemctl enable "/nix/var/nix/profiles/default$SOCKET_SRC" +EOF + fi +} - handle_network_proxy +poly_configure_nix_daemon_service() { + if [ -e /run/systemd/system ]; then + _sudo "to set up the nix-daemon service" \ + systemctl link "/nix/var/nix/profiles/default$SERVICE_SRC" + + _sudo "to set up the nix-daemon socket service" \ + systemctl enable "/nix/var/nix/profiles/default$SOCKET_SRC" - _sudo "to load the systemd unit for nix-daemon" \ - systemctl daemon-reload + handle_network_proxy - _sudo "to start the nix-daemon.socket" \ - systemctl start nix-daemon.socket + _sudo "to load the systemd unit for nix-daemon" \ + systemctl daemon-reload - _sudo "to start the nix-daemon.service" \ - systemctl restart nix-daemon.service + _sudo "to start the nix-daemon.socket" \ + systemctl start nix-daemon.socket + _sudo "to start the nix-daemon.service" \ + systemctl restart nix-daemon.service + fi } poly_group_exists() {