Skip to content

Commit 0361057

Browse files
authored
Add building guide (#12)
1 parent 61cc4c4 commit 0361057

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,65 @@ server initialization by sending a configuration as follows:
3434
}
3535
```
3636

37+
## Building from Source
38+
39+
### Dependencies
40+
- (Mac only) Homebrew: `brew install git`
41+
- (Linux/Mac) [Installer](https://git-scm.com/downloads)
42+
- Pact executable (see [Instructions](https://github.com/kadena-io/pact))
43+
44+
To get the code, you can go [here](https://github.com/kadena-io/pact-lsp/releases/). Once you have the code, we can pick a build tool.
45+
46+
#### Building with Cabal
47+
48+
[Cabal](https://www.haskell.org/cabal/) is the preferred way to manage packages by the Haskell community. You will need a version of GHC
49+
installed on your machine to use it.
50+
51+
##### Dependencies
52+
53+
- `ghc >= 9.6` (Haskell compiler) and `cabal >= 2.2` (Haskell build-tool)
54+
- The easiest way to get this is to install it using (Linux/Mac) [ghcup](https://www.haskell.org/ghcup/) and issue `ghcup install 9.6.2`, followed by `ghcup install-cabal`.
55+
- ghc may also be installed via brew, issuing `brew install ghc` and `brew install cabal-install`.
56+
57+
To build a Pact LSP binary:
58+
59+
```bash
60+
# Only necessary if you haven't done this recently.
61+
cabal v2-update
62+
63+
# Build the project.
64+
cabal v2-build
65+
```
66+
67+
This will install a runnable version of the Pact LSP, which you can run via:
68+
69+
```bash
70+
cabal v2-exec pact-lsp
71+
```
72+
73+
Alternatively, running `cabal v2-install exe:pact-lsp` inside this repository's root will install the binary to `~/.cabal/bin/`, which
74+
you may need to add to your path. Then, you can call `pact-lsp` as-is.
75+
76+
77+
#### Building with Nix
78+
79+
The fastest way to build and run Pact is to use the Nix package manager
80+
which has binary caching capabilities that allow you to download pre-built
81+
binaries for everything needed by Pact.
82+
We use nix flakes (which requires users to set `--experimental-features "nix-command flakes"`)
83+
to build pact and its dependencies. For detailed instructions see [our
84+
wiki](https://github.com/kadena-io/pact/wiki/Building-Kadena-Projects).
85+
86+
To build the Pact executable:
87+
```bash
88+
nix build
89+
```
90+
When the build is finished, you can run the Pact LSP with the following command:
91+
92+
```bash
93+
./result/bin/pact-lsp
94+
```
95+
3796
## Troubleshooting
3897

3998
The `pact-lsp` executable accepts the `--debug` flag to generate a log file which can be used to further

0 commit comments

Comments
 (0)