juspay / omnix

🚧 A Nix companion to improve developer experience
https://omnix.page
GNU Affero General Public License v3.0
87 stars 6 forks source link

`om hack`: Initial setup of arbitrary project #316

Open srid opened 1 week ago

srid commented 1 week ago

Motivation

The user git clones some project. What to do next?

Mechanism

Generally speaking, 3 things need to happen:

  1. Setup the necessary Nix caches to avoid compiling locally
    • Notably, one might use a private Cachix cache. Suppose the read-only auth token is stored in the Git repo, we want to run both cachix authtoken ... and cachix use ...
  2. Run om health, which checks various things including that cachix cache are in use (we may need #315), and instruct users to fix the problems accordingly (cf. #291)
  3. Show "next steps", which varies between projects, but typically involves running direnv allow (or nix develop) as first step, followed by VSCode setup. This can be Markdown we render in the terminal.

Questions

(3) can be part of om show, but the whole 1-2-3 step process may well require a new subcommand?

Roadmap

srid commented 1 week ago

This seems to be the better markdown renderer:

https://github.com/swsnr/mdcat

Takes a bunch of setting up, however:

image

Result:

image

Surprisingly, those links are clickable by default - hover over (they get underlined) and click. Not even need to press modifier keys like Cmd.

image

EDIT: It can also output images, if the right terminal is configured:

image
srid commented 6 hours ago

We actually don't strictly need to do cachix part in om hack, because it can done outside of it.

cachix use is obviated by flake.nix:nixConfig:

image

which we can activate in omnixrc:

image

This leaves us with cachix authtoken ..., but that too can be added to the user's .envrc.