Notes for macOS setup of Nix in the main README. (#13051)

* Notes for macOS setup of Nix.

* Some more notes on importing a project in Intellij.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Raymond Roestenburg 2022-03-02 09:49:12 +01:00 committed by GitHub
parent 4ca3fe73b4
commit e4d05e7924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 3 deletions

View File

@ -134,8 +134,12 @@ proceed to the IntelliJ integration.
### Setup
If you use the IntelliJ IDE you should install the [Bazel integration plugin
provided by Google][intellij_plugin]. Follow the [installation
instructions][intellij_plugin_install] in the official documentation. In short:
provided by Google][intellij_plugin].
Not every version of Intellij works with the Bazel plugin. Intellij IDEA 2021.2.4 has been verified to work correctly with the Bazel plugin.
It is advisable to use the JetBrains Toolbox to manage installations of Intellij IDEA.
Follow the [installation instructions][intellij_plugin_install] in the official documentation. In short:
Install the plugin from within the IDE (`Settings > Plugins > Marketplace`, and
search for 'Bazel'). Multiple Bazel plugins exist, make sure to select the Bazel
plugin referencing [ij.bazel.build][intellij_plugin].
@ -145,6 +149,8 @@ might be too recent, and the Bazel plugin might not have been upgraded to
support it, yet. Check for version compatibility on the [JetBrains plugin
page][intellij_plugin_jetbrains].
Set the Bazel binary in the Bazel plugin settings, at `Preferences -> Bazel Settings -> Bazel binary location` to point to the Bazel binary in the `dev-env/bin` directory.
[intellij_plugin]: https://ij.bazel.build/
[intellij_plugin_install]: https://ij.bazel.build/docs/bazel-plugin.html#getting-started
[intellij_plugin_jetbrains]: https://plugins.jetbrains.com/plugin/8609-bazel
@ -198,6 +204,7 @@ Make sure to add Scala, or other languages that you require, to the
`additional_languages` section. The section will be pre-populated with a list
of comments specifying the automatically detected supported languages.
Also ensure that you install and setup the Scala plugin.
If you'd like to work with all directories, we recommend the following project
view configuration, which stops IntelliJ from indexing the Bazel cache, and
avoids rebuilding the documentation:

View File

@ -41,7 +41,7 @@ cd daml
Our builds require various development dependencies (e.g. Java, Bazel, Python), provided by a tool called `dev-env`.
#### Linux and Mac
#### Linux
On Linux and Mac `dev-env` can be installed with:
@ -52,6 +52,31 @@ If you don't want to enter `dev-env` manually each time using `eval "$(dev-env/b
you can also install [direnv](https://direnv.net). This repo already provides a `.envrc`
file, with an option to add more in a `.envrc.private` file.
#### Mac
On Mac `dev-env` can be installed with:
1. Install Nix by running: `bash <(curl -sSfL https://nixos.org/nix/install)`
This is a *multi-user installation* (there is no single-user installation option for macOS). Because of this, you need to configure `/etc/nix/nix.conf` to use Nix caches.
You can add the contents of `dev-env/etc/nix.conf` to `/etc/nix/nix.conf`, but keep `build-users-group = nixbld` instead of leaving this empty as is done in `dev-env/etc/nix.conf`. Make sure to restart the `nix-daemon` after you have made changes to `/etc/nix/nix.conf`, for instance by using `sudo launchctl stop org.nixos.nix-daemon`.
2. Enter `dev-env` by running: `eval "$(dev-env/bin/dade assist)"`
If you don't want to enter `dev-env` manually each time using `eval "$(dev-env/bin/dade assist)"`,
you can also install [direnv](https://direnv.net). This repo already provides a `.envrc`
file, with an option to add more in a `.envrc.private` file.
Note that after a macOS update it can appear as if Nix is not installed. This is because macOS updates can modify shell config files in `/etc`, which the multi-user installation of Nix modifies as well. A workaround for this problem is to add the following to your shell config file in your `$HOME` directory:
```
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
```
See https://github.com/NixOS/nix/issues/3616 for more information about this issue.
#### Windows
On Windows you need to enable long file paths by running the following command in an admin powershell: