Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
4.9 kB · 162 lines
Markdown
at test-pr-link
# hacking on tangled
We highly recommend [installing
nix](https://nixos.org/download/) (the package manager)
before working on the codebase. The nix flake provides a lot
of helpers to get started and most importantly, builds and
dev shells are entirely deterministic.
To set up your dev environment:
```bash
nix develop
```
Non-nix users can look at the `devShell` attribute in the
`flake.nix` file to determine necessary dependencies.
## running the appview
The nix flake also exposes a few `app` attributes (run `nix
flake show` to see a full list of what the flake provides),
one of the apps runs the appview with the `air`
live-reloader:
```bash
TANGLED_DEV=true nix run .#watch-appview
# TANGLED_DB_PATH might be of interest to point to
# different sqlite DBs
# in a separate shell, you can live-reload tailwind
nix run .#watch-tailwind
```
To authenticate with the appview, you will need redis and
OAUTH JWKs to be setup:
```
# oauth jwks should already be setup by the nix devshell:
echo $TANGLED_OAUTH_JWKS
{"crv":"P-256","d":"tELKHYH-Dko6qo4ozYcVPE1ah6LvXHFV2wpcWpi8ab4","kid":"1753352226","kty":"EC","x":"mRzYpLzAGq74kJez9UbgGfV040DxgsXpMbaVsdy8RZs","y":"azqqXzUYywMlLb2Uc5AVG18nuLXyPnXr4kI4T39eeIc"}
# if not, you can set it up yourself:
go build -o genjwks.out ./cmd/genjwks
export TANGLED_OAUTH_JWKS="$(./genjwks.out)"
# run redis in at a new shell to store oauth sessions
redis-server
```
## running knots and spindles
An end-to-end knot setup requires setting up a machine with
`sshd`, `AuthorizedKeysCommand`, and git user, which is
quite cumbersome. So the nix flake provides a
`nixosConfiguration` to do so.
<details>
<summary><strong>MacOS users will have to setup a Nix Builder first</strong></summary>
In order to build Tangled's dev VM on macOS, you will
first need to set up a Linux Nix builder. The recommended
way to do so is to run a [`darwin.linux-builder`
VM](https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder)
and to register it in `nix.conf` as a builder for Linux
with the s…