-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated contribute docs to reflect latest dev changes
Fixes #1813
- Loading branch information
1 parent
95891d0
commit bf41052
Showing
1 changed file
with
20 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ We are happy to merge your pull requests! | |
|
||
## devenv | ||
|
||
The IHP framework itself uses devenv.sh to set up the development environment. It is a wrapper around `nix-shell` and `direnv`. | ||
The IHP framework itself uses devenv.sh to set up the development environment. It is a wrapper around `nix develop` and `direnv`. | ||
|
||
Follow the [devenv documentation](https://devenv.sh/getting-started/) to set it up. | ||
|
||
|
@@ -22,7 +22,7 @@ devenv up | |
|
||
Running `devenv up` is necessary, even if you don't intend to run it this way (e.g. you intend to do development and don't intend to run it "normally"), to do some initial setup like creating the database. You can keep `devenv up` running, as it will pick up any changes to the custom app or the IHP, and save you the hassle of manually recompiling from ghci on every change. | ||
|
||
Clone the IHP repository into the project directory. The `IHP` directory is added to the GHC search path in applicationGhciConfig. Therefore when the `IHP` directory exists, GHC will load all IHP modules from there. | ||
Clone the IHP repository into the project directory. The `IHP` directory is added to the GHC search path in `applicationGhciConfig`. Therefore when the `IHP` directory exists, GHC will load all IHP modules from there. | ||
|
||
``` | ||
git clone [email protected]:digitallyinduced/ihp.git IHP | ||
|
@@ -31,15 +31,29 @@ cd IHP | |
direnv allow | ||
# Go back to the project root (do not run inside the IHP directory) | ||
cd - | ||
make -B build/ihp-lib | ||
``` | ||
|
||
### Faster Haskell Builds | ||
|
||
Uncomment the `configureFlags = [ "--flag FastBuild" ];` and `doHaddock = false;` lines in the `IHP/ihp.nix` for fast rebuilds, otherwise you could up waiting up to half an hour while IHP builds itself. | ||
|
||
We need to make sure not to commit the changes of `IHP/ihp.nix` | ||
To help us with that, you can run this from the root of your project `cd IHP && git update-index --assume-unchanged ihp.nix`, so git will ignore your changes. | ||
|
||
It is important to update your custom `default.nix` file and set the `rev` to the latest commit every time you perform a `git pull` from within IHP. This is because certain components continue to use the version defined in `default.nix`, even if you have a local IHP. | ||
### Nix Changes | ||
|
||
If you're testing local nix changes, you need to change your `flake.nix` to point to the IHP project instead of pulling it from github: | ||
|
||
```nix | ||
{ | ||
inputs = { | ||
# The path needs to be absolute | ||
ihp.url = "path:///Users/myuser/someproject/IHP"; | ||
# ... | ||
}; | ||
``` | ||
|
||
After that run `nix flake update`. | ||
|
||
### Running the latest IHP `master` | ||
|
||
|
@@ -72,7 +86,7 @@ ghci | |
main | ||
``` | ||
|
||
We don't start postgres as the IDE starts it automatically. | ||
We don't need to start postgres as the IDE starts it automatically. | ||
|
||
#### Debugging the development server | ||
|
||
|
@@ -178,30 +192,15 @@ Additionally every released version of IHP is tagged. [You can see a list of all | |
|
||
## Troubleshooting | ||
|
||
### `can't satisfy package ihp` | ||
|
||
If you get an error like `can't satisfy package ihp` or all other IHP packages when running `ghci` most likely the symlink in `build/ihp-lib` is not set up as expected. IHP uses the symlink `build/ihp-lib` in your application's `.ghci` file to access [`IHP/lib/IHP/applicationGhciConfig`](https://github.com/digitallyinduced/ihp/blob/master/lib/IHP/applicationGhciConfig#L39). This `applicationGhciConfig` sets up all the required options for `ghci`. | ||
|
||
Try to run `make -B build/ihp-lib` to create the symlink. | ||
|
||
### `error: Could not find module 'Generated.Types'` | ||
|
||
You may receive this error when trying to load modules into GHCI like `:l Main`. Run `chmod go-w .` to change the permissions so the `.ghci` file could be loaded properly. | ||
|
||
### Error messages about missing packages in `ghci` | ||
|
||
Perhaps a package was added to IHP recently. Start a `nix-shell` in the IHP directory to fetch missing packages. | ||
|
||
### Trouble adding packages to IHP | ||
|
||
Either add the package to your project's `default.nix` as well, or change the section `ihp = builtins.fetchGit ...` to `ihp = ./IHP;`in your project's `default.nix`. Then the `IHP/ihp.nix` will be used to fetch packages. | ||
|
||
### Type errors in `build/Generated/Types.hs` | ||
|
||
The errors comes from changes to the Schema Compiler, so `build/Generated/Types.hs` is outdated. The error only happens when we have backwards compatibility breaks in some of the interfaces, which doesn't happen very often. If you do get them you should execute from your appication's root directory (not the `IHP` directory) | ||
|
||
``` | ||
nix-shell | ||
ghci | ||
:l IHP/IHP/SchemaCompiler.hs | ||
compile | ||
|
@@ -215,8 +214,7 @@ If you want to go back and use the standard IHP library instead of the cloned so | |
|
||
``` | ||
rm -rf IHP | ||
rm build/ihp-lib | ||
./start | ||
devenv up | ||
``` | ||
|
||
## Resources | ||
|