···11+# hacking on tangled22+33+We highly recommend [installing44+nix](https://nixos.org/download/) (the package manager)55+before working on the codebase. The nix flake provides a lot66+of helpers to get started and most importantly, builds and77+dev shells are entirely deterministic.88+99+To set up your dev environment:1010+1111+```bash1212+nix develop1313+```1414+1515+Non-nix users can look at the `devShell` attribute in the1616+`flake.nix` file to determine necessary dependencies.1717+1818+## running the appview1919+2020+The nix flake also exposes a few `app` attributes (run `nix2121+flake show` to see a full list of what the flake provides),2222+one of the apps runs the appview with the `air`2323+live-reloader:2424+2525+```bash2626+TANGLED_DEV=true nix run .#watch-appview2727+2828+# TANGLED_DB_PATH might be of interest to point to2929+# different sqlite DBs3030+3131+# in a separate shell, you can live-reload tailwind3232+nix run .#watch-tailwind3333+```3434+3535+## running a knotserver3636+3737+An end-to-end knotserver setup requires setting up a machine3838+with `sshd`, `repoguard`, `keyfetch`, a git user, which is3939+quite cumbersome and so the nix flake provides a4040+`nixosConfiguration` to do so.4141+4242+To begin, head to `http://localhost:3000` in the browser and4343+generate a knotserver secret. Replace the existing secret in4444+`flake.nix` with the newly generated secret.4545+4646+You can now start a lightweight NixOS VM using4747+`nixos-shell` like so:4848+4949+```bash5050+QEMU_NET_OPTS="hostfwd=tcp::6000-:6000,hostfwd=tcp::2222-:22" nixos-shell --flake .#knotVM5151+5252+# hit Ctrl-a + c + q to exit the VM5353+```5454+5555+This starts a knotserver on port 6000 with `ssh` exposed on5656+port 2222. You can push repositories to this VM with this5757+ssh config block on your main machine:5858+5959+```bash6060+Host nixos-shell6161+ Hostname localhost6262+ Port 22226363+ User git6464+ IdentityFile ~/.ssh/my_tangled_key6565+```6666+6767+Set up a remote called `local-dev` on a git repo:6868+6969+```bash7070+git remote add local-dev git@nixos-shell:user/repo7171+git push local-dev main7272+```