add basic docs for nix install

This commit is contained in:
John Murray 2023-12-11 22:56:02 -05:00
parent 5a9dfe8f8c
commit ce7fb7ec50
No known key found for this signature in database
4 changed files with 53 additions and 1 deletions

View File

@ -11,6 +11,7 @@ If you have a specific question, the [FAQ](../FAQ.md) might have an answer, alth
## Installation
- [🐧 Linux x86_64](linux_x86_64.md)
- [❄️ Nix Linux/MacOS](nix.md)
- [🍏 MacOS Apple Silicon](macos_apple_silicon.md)
- [🍏 MacOS x86_64](macos_x86_64.md)
- [🟦 Windows](windows.md)

49
getting_started/nix.md Normal file
View File

@ -0,0 +1,49 @@
# Roc installation guide for Nix
## NixOS quick start
<details>
<summary>
## Install via Flakes
</summary>
### Bootstrap a project with a template
```shell
# use the template in the current directory
nix flake init --template github:roc-lang/roc#simple --refresh
```
### Add roc to existing flake
```nix
{
inputs = {
roc.url = "github:roc-lang/roc";
};
outputs = {roc,flake-utils, ...}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
rocPkgs = roc.packages.${system};
in
{
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs;
[
rocPkgs.cli
];
};
};
}
);
}
```
</details>

View File

@ -25,6 +25,7 @@
rocFull # cli included in here
];
# ROC_LSP_PATH will be read by https://github.com/ivan-demchenko/roc-vscode-unofficial
shellHook = ''
export ROC_LSP_PATH=${rocFull}/bin/roc_ls
'';

View File

@ -5,7 +5,7 @@ Roc is a very young language with many incomplete features and known bugs. It do
There are currently a few known OS-specific issues:
* **macOS:** There are no known compatibility issues, but the compiler doesn't run as fast as it does on Linux or Windows, because we don't (yet) do our own linking like we do on those targets. (Linking works similarly on Linux and Windows, but the way macOS does it is both different and significantly more complicated.)
* **Windows:** There are some known Windows-specific compiler bugs, and probably some other unknown ones because more people have tried out Roc on Mac and Linux than on Windows.
* **Linux:** The nightlies are built with glibc, so they aren't usable on distros that don't use (dynamically linked) glibc, like Alpine or NixOS. In the future we plan to build Linux releases with [musl libc](https://wiki.musl-libc.org/) to address this, but this requires [building LLVM from source with musl](https://wiki.musl-libc.org/building-llvm.html).
* **Linux:** The nightlies are built with glibc, so they aren't usable on distros that don't use (dynamically linked) glibc, like Alpine. In the future we plan to build Linux releases with [musl libc](https://wiki.musl-libc.org/) to address this, but this requires [building LLVM from source with musl](https://wiki.musl-libc.org/building-llvm.html).
* **Other operating systems:** Roc has not been built on any other operating systems. [Building from source](https://github.com/roc-lang/roc/blob/main/BUILDING_FROM_SOURCE.md) on another OS might work, but you might very well be the first person ever to try it!
### [Getting Started](#getting-started) {#getting-started}
@ -14,6 +14,7 @@ Here are some Getting Started guides for different operating systems:
<!-- TODO detect current OS with browser and only show link for that, provide other button for others -->
- [Linux x86-64](https://github.com/roc-lang/roc/blob/main/getting_started/linux_x86_64.md)
- [Nix Linux/MacOS](https://github.com/roc-lang/roc/blob/main/getting_started/nix.md)
- [MacOS Apple Silicon](https://github.com/roc-lang/roc/blob/main/getting_started/macos_apple_silicon.md)
- [MacOS x86-64](https://github.com/roc-lang/roc/blob/main/getting_started/macos_x86_64.md)
- [Windows](https://github.com/roc-lang/roc/blob/main/getting_started/windows.md)