···5656}
57575858type FollowStats struct {
5959- Followers int
6060- Following int
5959+ Followers int64
6060+ Following int64
6161}
62626363func GetFollowerFollowingCount(e Execer, did string) (FollowStats, error) {
6464- followers, following := 0, 0
6464+ var followers, following int64
6565 err := e.QueryRow(
6666 `SELECT
6767 COUNT(CASE WHEN subject_did = ? THEN 1 END) AS followers,
···122122123123 for rows.Next() {
124124 var did string
125125- var followers, following int
125125+ var followers, following int64
126126 if err := rows.Scan(&did, &followers, &following); err != nil {
127127 return nil, err
128128 }
+14
appview/db/profile.go
···2222 ByMonth []ByMonth
2323}
24242525+func (p *ProfileTimeline) IsEmpty() bool {
2626+ if p == nil {
2727+ return true
2828+ }
2929+3030+ for _, m := range p.ByMonth {
3131+ if !m.IsEmpty() {
3232+ return false
3333+ }
3434+ }
3535+3636+ return true
3737+}
3838+2539type ByMonth struct {
2640 RepoEvents []RepoEvent
2741 IssueEvents IssueEvents
···4848redis-server
4949```
50505151-## running a knot
5151+## running knots and spindles
52525353An end-to-end knot setup requires setting up a machine with
5454`sshd`, `AuthorizedKeysCommand`, and git user, which is
5555quite cumbersome. So the nix flake provides a
5656`nixosConfiguration` to do so.
57575858-To begin, grab your DID from http://localhost:3000/settings.
5959-Then, set `TANGLED_VM_KNOT_OWNER` and
6060-`TANGLED_VM_SPINDLE_OWNER` to your DID.
5858+<details>
5959+ <summary><strong>MacOS users will have to setup a Nix Builder first</strong></summary>
6060+6161+ In order to build Tangled's dev VM on macOS, you will
6262+ first need to set up a Linux Nix builder. The recommended
6363+ way to do so is to run a [`darwin.linux-builder`
6464+ VM](https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder)
6565+ and to register it in `nix.conf` as a builder for Linux
6666+ with the same architecture as your Mac (`linux-aarch64` if
6767+ you are using Apple Silicon).
6868+6969+ > IMPORTANT: You must build `darwin.linux-builder` somewhere other than inside
7070+ > the tangled repo so that it doesn't conflict with the other VM. For example,
7171+ > you can do
7272+ >
7373+ > ```shell
7474+ > cd $(mktemp -d buildervm.XXXXX) && nix run nixpkgs#darwin.linux-builder
7575+ > ```
7676+ >
7777+ > to store the builder VM in a temporary dir.
7878+ >
7979+ > You should read and follow [all the other intructions][darwin builder vm] to
8080+ > avoid subtle problems.
8181+8282+ Alternatively, you can use any other method to set up a
8383+ Linux machine with `nix` installed that you can `sudo ssh`
8484+ into (in other words, root user on your Mac has to be able
8585+ to ssh into the Linux machine without entering a password)
8686+ and that has the same architecture as your Mac. See
8787+ [remote builder
8888+ instructions](https://nix.dev/manual/nix/2.28/advanced-topics/distributed-builds.html#requirements)
8989+ for how to register such a builder in `nix.conf`.
61906262-If you don't want to [set up a spindle](#running-a-spindle),
6363-you can use any placeholder value.
9191+ > WARNING: If you'd like to use
9292+ > [`nixos-lima`](https://github.com/nixos-lima/nixos-lima) or
9393+ > [Orbstack](https://orbstack.dev/), note that setting them up so that `sudo
9494+ > ssh` works can be tricky. It seems to be [possible with
9595+ > Orbstack](https://github.com/orgs/orbstack/discussions/1669).
64966565-You can now start a lightweight NixOS VM like so:
9797+</details>
9898+9999+To begin, grab your DID from http://localhost:3000/settings.
100100+Then, set `TANGLED_VM_KNOT_OWNER` and
101101+`TANGLED_VM_SPINDLE_OWNER` to your DID. You can now start a
102102+lightweight NixOS VM like so:
6610367104```bash
68105nix run --impure .#vm
···74111with `ssh` exposed on port 2222.
7511276113Once the services are running, head to
7777-http://localhost:3000/knots and hit verify (and similarly,
7878-http://localhost:3000/spindles to verify your spindle). It
7979-should verify the ownership of the services instantly if
8080-everything went smoothly.
114114+http://localhost:3000/knots and hit verify. It should
115115+verify the ownership of the services instantly if everything
116116+went smoothly.
8111782118You can push repositories to this VM with this ssh config
83119block on your main machine:
···97133git push local-dev main
98134```
99135100100-## running a spindle
136136+### running a spindle
101137102138The above VM should already be running a spindle on
103139`localhost:6555`. Head to http://localhost:3000/spindles and
···119155# litecli has a nicer REPL interface:
120156litecli /var/lib/spindle/spindle.db
121157```
158158+159159+If for any reason you wish to disable either one of the
160160+services in the VM, modify [nix/vm.nix](/nix/vm.nix) and set
161161+`services.tangled-spindle.enable` (or
162162+`services.tangled-knot.enable`) to `false`.