Skip to content

Commit f21eb9c

Browse files
committed
Improve dev environment
1 parent 51452ed commit f21eb9c

8 files changed

+539
-6
lines changed

.envrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
2+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
3+
fi
4+
5+
watch_file flake.nix
6+
watch_file flake.lock
7+
if ! use flake . --impure
8+
then
9+
echo "devenv could not be built. The devenv environment was not loaded." >&2
10+
fi
11+

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ vendor/
2121
# it's handy to have a docker-compose available during development
2222
docker-compose.yml
2323

24-
.pre-commit-config.yaml
25-
2624
dist/
27-
28-
25+
.devenv/
26+
.direnv/
27+
.pre-commit-config.yaml

README.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,40 @@ nq.Enqueue(ctx, &jobs.Job{
123123

124124
Additional example integration code can be found at https://github.com/acaloiaro/neoq/tree/main/examples
125125

126+
# Developing
127+
128+
Neoq development is largely based on Nix and `devenv`.
129+
130+
After [installing nix](https://nixos.org/download), this repository contains everything else you will need to develop
131+
and run tests.
132+
133+
## Automatic setup and teardown
134+
135+
`direnv` is used to let neoq automatically configure its own dev environment. This includes installing dependencies and
136+
developer tooling.
137+
138+
See [installing direnv](https://direnv.net/docs/installation.html) if you want the dev environment setup to be automated.
139+
140+
## Manual setup and teardown
141+
142+
Neoq uses `devenv` to manage development environments and services.
143+
144+
To enter the development shell, run `nix develop --impure`.
145+
146+
In order to run the test suite, the required services need to be started. Start services by running the following:
147+
148+
## Running services for tests
149+
150+
The neoq development shell gives you the `devenv` executable.
151+
152+
To run postgres and redis for tests and development, run
153+
154+
```
155+
devenv up
156+
```
157+
158+
This runs Postgres and Redis in the foreground. In a separate terminal, run `make test` to run the test suite.
159+
126160
# Status
127161

128-
This project is currently in alpha. Future releases may change the API.
162+
This project is currently pre-1.0. Future releases may change the API.

bin/gomod2nix

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!env bash
2+
3+
gomod2nix

flake.lock

+308
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)