···
3
+
We highly recommend [installing
4
+
nix](https://nixos.org/download/) (the package manager)
5
+
before working on the codebase. The nix flake provides a lot
6
+
of helpers to get started and most importantly, builds and
7
+
dev shells are entirely deterministic.
9
+
To set up your dev environment:
15
+
Non-nix users can look at the `devShell` attribute in the
16
+
`flake.nix` file to determine necessary dependencies.
18
+
## running the appview
20
+
The nix flake also exposes a few `app` attributes (run `nix
21
+
flake show` to see a full list of what the flake provides),
22
+
one of the apps runs the appview with the `air`
26
+
TANGLED_DEV=true nix run .#watch-appview
28
+
# TANGLED_DB_PATH might be of interest to point to
29
+
# different sqlite DBs
31
+
# in a separate shell, you can live-reload tailwind
32
+
nix run .#watch-tailwind
35
+
## running a knotserver
37
+
An end-to-end knotserver setup requires setting up a machine
38
+
with `sshd`, `repoguard`, `keyfetch`, a git user, which is
39
+
quite cumbersome and so the nix flake provides a
40
+
`nixosConfiguration` to do so.
42
+
To begin, head to `http://localhost:3000` in the browser and
43
+
generate a knotserver secret. Replace the existing secret in
44
+
`flake.nix` with the newly generated secret.
46
+
You can now start a lightweight NixOS VM using
47
+
`nixos-shell` like so:
50
+
QEMU_NET_OPTS="hostfwd=tcp::6000-:6000,hostfwd=tcp::2222-:22" nixos-shell --flake .#knotVM
52
+
# hit Ctrl-a + c + q to exit the VM
55
+
This starts a knotserver on port 6000 with `ssh` exposed on
56
+
port 2222. You can push repositories to this VM with this
57
+
ssh config block on your main machine:
64
+
IdentityFile ~/.ssh/my_tangled_key
67
+
Set up a remote called `local-dev` on a git repo:
70
+
git remote add local-dev git@nixos-shell:user/repo
71
+
git push local-dev main