Skip to content

Commit

Permalink
feat: Enhance Nix setup and update README
Browse files Browse the repository at this point in the history
- Add 'topos' package for direct execution
- Create 'topos' dev shell with auto-start
- Update README with new Nix usage instructions
- Remove outdated Spacy model setup steps
  • Loading branch information
G-structure committed Oct 16, 2024
1 parent a0f58da commit cad580b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
50 changes: 36 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<em>Private AI Backend Service</em>
</p>

---
---

# Topos
A personal intelligence service, using your own computer to power private conversations with friends, family, and coworkers, collect/store your own private data, and use AI privately. Runs great with the [chat arena](https://github.com/jonnyjohnson1/chat-arena) app available on desktop and mobile.
Expand All @@ -19,17 +19,38 @@ You should be able to launch the Topos service anywhere from your machine.

## Install with nix (Recommended)
If nix is not installed:
1. Install nix:
macos/linux: `sh <(curl -L https://nixos.org/nix/install)`
windows: `sh <(curl -L https://nixos.org/nix/install) --daemon`
1. Install nix:
macos/linux: `sh <(curl -L https://nixos.org/nix/install)`
windows: `sh <(curl -L https://nixos.org/nix/install) --daemon`
Run the software with nix:
1. Download this repo `git clone https://github.com/jonnyjohnson1/topos-cli`
2. `cd topos-cli`
3. build the backend service (only run the topos set --spacy trf line if it is your first time setting up)
2. Download this repo `git clone https://github.com/jonnyjohnson1/topos-cli`
3. `cd topos-cli`
3. ~~build the backend service (only run the topos set --spacy trf line if it is your first time setting up)~~

### Production
First build topos binary (only usable on machines with nix installed)
```
nix build .#topos
```
run built binary
```
./result/bin/topos
```

### Dev Shell
```
nix develop
run topos
```

### Dev Shell (auto start server)
```
nix develop .#topos
```

### Poetry Shell
```
nix-shell
topos set --spacy trf
topos run
nix develop .#poetry
```

## Install Instructions
Expand All @@ -49,8 +70,9 @@ brew services start neo4j
install the topos package with the command `just build`

### Step 2: Set the Spacy Model Size
Set the size of the spacy model you wish to use on your system.
There are 'small', 'med', 'large', and 'trf'.
**BROKEN**
Set the size of the spacy model you wish to use on your system.
There are 'small', 'med', 'large', and 'trf'.

Use the tag like this.
`topos set --spacy small`
Expand All @@ -68,12 +90,12 @@ zrok is opensourced and free.
ngrok has a gated requests/month under its free tier, then requires you pay for it.

1. Be sure you have the `topos` server running already in another terminal.
2. [Install zrok command](https://docs.zrok.io/docs/getting-started/?_gl=1*1yet1eb*_ga*MTQ1MDc2ODAyNi4xNzE3MDE3MTE3*_ga_V2KMEXWJ10*MTcxNzAxNzExNi4xLjAuMTcxNzAxNzExNi42MC4wLjA.*_gcl_au*NDk3NjM1MzEyLjE3MTcwMTcxMTc.#installing-the-zrok-command)
2. [Install zrok command](https://docs.zrok.io/docs/getting-started/?_gl=1*1yet1eb*_ga*MTQ1MDc2ODAyNi4xNzE3MDE3MTE3*_ga_V2KMEXWJ10*MTcxNzAxNzExNi4xLjAuMTcxNzAxNzExNi42MC4wLjA.*_gcl_au*NDk3NjM1MzEyLjE3MTcwMTcxMTc.#installing-the-zrok-command)
3. `zrok enable <given_key>`
4. `zrok status` should show you information
5. Route local path through zrok: `zrok share public http://0.0.0.0:13341`
This will take you to a new screen with an https://<url> at the top.
Insert this url into the field under settings-> "Api Endpoints" -> "Custom API"
Insert this url into the field under settings-> "Api Endpoints" -> "Custom API"
6. After you've insert it into the field, press the test button, and "hello world" should appear next to the button.

[ ] Enable permanent sharing of zrok url [docs](https://docs.zrok.io/docs/guides/docker-share/#permanent-public-share) (requires Docker)
Expand Down
23 changes: 22 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@

in
{
packages.default = pkgs.myapp;
packages = {
default = pkgs.myapp;
topos = pkgs.writeShellScriptBin "topos" ''
export PATH="${pkgs.myapp}/bin:$PATH"
${pkgs.myapp}/bin/topos run
'';
};

devShells = {
# Shell for app dependencies.
#
Expand All @@ -63,6 +70,20 @@
'';
};

# Shell for topos
#
# nix develop .#topos
#
# Use this shell running topos
topos = pkgs.mkShell {
inputsFrom = [ pkgs.myapp ];

shellHook = ''
export PATH="${pkgs.myapp}/bin:$PATH"
topos run
'';
};

# Shell for poetry.
#
# nix develop .#poetry
Expand Down

0 comments on commit cad580b

Please sign in to comment.