-
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6281 from JRMurr/nix-template-setup
Add install docs for nix + fix `nix run` for using the roc cli
- Loading branch information
Showing
7 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## Try out | ||
|
||
To quickly try out roc without installing, use `nix run`: | ||
```shell | ||
nix run roc-lang/roc -- <roc args> | ||
# examples: | ||
# - nix run roc-lang/roc -- repl | ||
# - nix run roc-lang/roc -- dev main.roc | ||
``` | ||
|
||
## Use with Flakes | ||
|
||
|
||
### Start your project with our 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 = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
roc.url = "github:roc-lang/roc"; | ||
}; | ||
outputs = {nixpkgs, 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 | ||
]; | ||
}; | ||
}; | ||
} | ||
); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ ... }: rec { | ||
default = simple; | ||
simple = { | ||
description = "Basic flake with roc cli + lsp"; | ||
path = ./simple; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
description = "Roc flake template"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
roc.url = "github:roc-lang/roc"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, roc, ... }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
|
||
# see "packages =" in https://github.com/roc-lang/roc/blob/main/flake.nix | ||
rocPkgs = roc.packages.${system}; | ||
|
||
rocFull = rocPkgs.full; | ||
|
||
in | ||
{ | ||
formatter = pkgs.nixpkgs-fmt; | ||
|
||
devShells = { | ||
default = pkgs.mkShell { | ||
buildInputs = with pkgs; | ||
[ | ||
rocFull # includes CLI | ||
]; | ||
|
||
# For vscode plugin https://github.com/ivan-demchenko/roc-vscode-unofficial | ||
shellHook = '' | ||
export ROC_LSP_PATH=${rocFull}/bin/roc_ls | ||
''; | ||
}; | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters