Merge pull request #1864 from rtfeldman/nix_tip_editor

better nix editor instructions
This commit is contained in:
Richard Feldman 2021-11-01 22:28:41 -04:00 committed by GitHub
commit a928a3db2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 19 deletions

View file

@ -82,7 +82,7 @@ There are also alternative installation options at http://releases.llvm.org/down
## Using Nix ## Using Nix
:exclamation: **Our Nix setup is currently broken, you'll have to install manually for now** :exclamation: :exclamation: **Our Nix setup is not yet working on MacOS, you'll have to install manually for now** :exclamation:
### Install ### Install
@ -94,7 +94,7 @@ First, install nix:
`curl -L https://nixos.org/nix/install | sh` `curl -L https://nixos.org/nix/install | sh`
If MacOS and using a version >= 10.15: If you're on MacOS and using a OS version >= 10.15:
`sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume` `sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume`
@ -104,7 +104,7 @@ You may prefer to setup up the volume manually by following nix documentation.
### Usage ### Usage
Now with nix installed you just need to run one command: Now with nix installed, you just need to run one command:
`nix-shell` `nix-shell`
@ -124,29 +124,45 @@ If you plan on using `nix-shell` regularly, check out [direnv](https://direnv.ne
### Editor ### Editor
When you want to run the editor from Ubuntu inside nix you need to install [nixGL](https://github.com/guibou/nixGL) as well: `cargo run edit` should work from NixOS, if you use a nix-shell from inside another OS, follow the instructions below.
#### Nvidia GPU
Outside of a nix shell, execute the following:
```
nix-channel --add https://github.com/guibou/nixGL/archive/main.tar.gz nixgl && nix-channel --update
nix-env -iA nixgl.auto.nixVulkanNvidia
```
Running the editor does not work with `nix-shell --pure`.
```
nix-shell
```
460.91.03 may be different for you, type nixVulkanNvidia and press tab to autocomplete for your version.
```
nixVulkanNvidia-460.91.03 cargo run edit
```
#### Integrated Intel Graphics
:exclamation: ** Our Nix setup currently cannot run the editor with integrated intel graphics, see #1856 ** :exclamation:
Outside of a nix shell, run:
```bash ```bash
nix-shell
git clone https://github.com/guibou/nixGL git clone https://github.com/guibou/nixGL
cd nixGL cd nixGL
```
If you have an Nvidia graphics card, run:
```
nix-env -f ./ -iA nixVulkanNvidia
```
If you have integrated Intel graphics, run:
```
nix-env -f ./ -iA nixVulkanIntel nix-env -f ./ -iA nixVulkanIntel
``` ```
Check the [nixGL repo](https://github.com/guibou/nixGL) for other configurations.
Now you should be able to run the editor: cd to the roc repo, and run (without --pure):
```bash
cd roc
nixVulkanNvidia cargo run edit `# replace Nvidia with the config you chose in the previous step`
``` ```
nix-shell
nixVulkanIntel cargo run edit
```
#### Other configs
Check the [nixGL repo](https://github.com/guibou/nixGL) for other graphics configurations.
## Troubleshooting ## Troubleshooting

View file

@ -79,7 +79,9 @@ fn run_event_loop(project_dir_path_opt: Option<&Path>) -> Result<(), Box<dyn Err
compatible_surface: Some(&surface), compatible_surface: Some(&surface),
}) })
.await .await
.expect("Request adapter"); .expect(r#"Request adapter
If you're running this from inside nix, follow the instructions here to resolve this: https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#editor
"#);
adapter adapter
.request_device( .request_device(