Skip to content

Commit 20416f0

Browse files
Overhaul and modernize Nix flake setup (#706)
* add envrc for direnv users this was already used by several developers, this just makes it official * replace run-tests-script with nix flake check this also allows us to remove our single 'spago test' invocation in a github workflow, so all CI checks are in the Nix checks for Garnix to execute while i was at it, i removed the nix flakes wrapper, shell.nix, and flake-compat inclusions as at this point pretty much everyone is on a flake-compatible version of Nix * extract wiremock mappings * migrate to buildNpmPackage from slimlock slimlock was the homegrown npm dependency builder from ps-overlay from before when buildNpmPackage was a suitable choice for the registry, but at this point it's well-suited to be the standard choice for us. * overhaul nix flake setup our homegrown nix setup has diverged quite a bit from modern best practices and is hard to read. it also included some unnecessary helpers (like run-vm to work on a local vm) which we can remove. this change overhauls the full setup while maintaining the existing tests to make it simpler, more performant, and more usable for contributors. the deployments are still simple ('colmena apply').
1 parent 00000a7 commit 20416f0

File tree

19 files changed

+952
-1349
lines changed

19 files changed

+952
-1349
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/main.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ result
1919

2020
# Keep it secret, keep it safe.
2121
.env
22-
.envrc

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,23 @@ There are three more directories containing code for the registry.
3939

4040
Finally, the `flake.nix` file orchestrates builds for the whole repository.
4141

42+
## Running the Registry Server Locally
43+
44+
The registry server requires a `.env` file and an initialized database. To run the server for development:
45+
46+
```sh
47+
# 1. Ensure database is initialized (only needed once)
48+
dbmate up
49+
50+
# 2. Run the server (from the nix shell)
51+
cd app && spago run
52+
```
53+
54+
The server will load environment variables from the `.env` file in the project root and run on port 8080 by default.
55+
4256
## Available Nix Commands
4357

44-
The Registry server can be run locally:
58+
You can also run the packaged registry server:
4559

4660
```sh
4761
nix run .#server
@@ -81,13 +95,6 @@ There is an integration test that will deploy the registry server and make reque
8195
nix build .#checks.x86_64-linux.integration
8296
```
8397

84-
You can "deploy" the registry server to a local VM and manually hit the API as if it were the production server:
85-
86-
```sh
87-
# The server will be available at localhost:8080
88-
nix run
89-
```
90-
9198
### Testing Guidelines
9299

93100
The PureScript code in the registry is well-tested, ranging from tests for individual functions to full end-to-end tests for the registry server running in a NixOS machine configured the same way as the deployed machine. The smaller and more pure the test, the easier it is to write and maintain; most code is tested via unit tests written with `spec`, and only the core pipelines are run in the integration test.

app/default.nix

Lines changed: 0 additions & 160 deletions
This file was deleted.

flake.lock

Lines changed: 15 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)