README.md

6.3 KB · raw

rendered · source

1# nina23**the best way to use nixos.**45Nina wraps the full NixOS workflow in plain, memorable verbs — packages, rebuilds, generations, flakes, services, remote machines. Written in Zig. Zero dependencies. One binary.67```8$ nina search ripgrep9$ nina apply10$ nina back11$ nina status --all12```1314---1516## install1718**nix profile** (recommended — instant, per-user, no `sudo`):1920```sh21nix profile add 'https://kepr.uk/nina/archive/HEAD.tar.gz#nina'22```2324Remove any time with `nina goodbye`.2526**koh** (build from source via koh):2728```sh29koh steal kepr.uk/nina30cd nina && zig build -Doptimize=ReleaseFast31sudo cp zig-out/bin/nina /usr/local/bin/nina32```3334**source archive** (download and build manually):3536Download the source archive from [kepr.uk/nina/releases](https://kepr.uk/nina/releases), then:3738```sh39tar xf nina-*.tar.gz && cd nina-*/40zig build -Doptimize=ReleaseFast41sudo cp zig-out/bin/nina /usr/local/bin/nina42```4344**linux · nixos 24.05+** — requires `nix-command` and `flakes` experimental features.  45Run `nina setup` on first use to enable them automatically.4647---4849## the commands you'll actually use5051```52nina apply           rebuild and switch to the new configuration53nina apply --dry     preview what would change without switching54nina back            roll back to the previous generation55nina go <n>          jump to any generation by number56nina history         list all generations57nina clean           remove old generations and free store space5859nina search <q>      search nixpkgs inline — browse, install, or try60nina option <q>      search NixOS options inline61nina install <p>     add a package — profile (instant) or system config62nina remove <p>      remove a package from profile or system config63nina try <p>         run a package without installing it64nina list            show installed packages6566nina home apply      apply home-manager config67nina home back       roll back one home-manager generation68nina home history    list home-manager generations69nina home edit       open home.nix70nina home check      validate home config without switching71nina home diff       compare the latest two home generations72nina home packages   list packages managed by home-manager7374nina status          machine health at a glance75nina status --all    health across every configured machine76nina doctor          diagnose common issues77nina diff            what changed between generations78nina log             operation history7980nina service list    list systemd services and their state81nina service logs <s> journal logs for a service82nina service start/stop/restart <s>8384nina flake show      inspect flake outputs85nina flake update    update lock files86nina develop         enter a dev shell87nina build           build a flake output88nina run <p>         run a package without installing8990nina edit            open configuration.nix in your editor91nina edit --dir      open the config directory in your editor92nina check           validate config without switching93nina fmt             format nix files94nina info            nixos version, kernel, uptime95nina boot            boot entries9697nina help            all commands98nina --version       version info99```100101---102103## hooks104105Nina runs optional executable hook scripts before and after state-changing commands.106Create them in `~/.config/nina/hooks/`:107108```109pre-apply     post-apply110pre-back      post-back111pre-home      post-home112pre-upgrade   post-upgrade113```114115Missing hooks are ignored. Hook files must be executable (`chmod +x`) to run.116If a pre-hook exits non-zero, Nina shows the last five output lines and asks117whether to continue, defaulting to no. If a post-hook exits non-zero, Nina shows118a warning after the command's success line.119120Example: stop `nina apply` when your config has uncommitted changes.121122```sh123#!/usr/bin/env sh124# ~/.config/nina/hooks/pre-apply125if git -C ~/nixos-config status --porcelain | grep -q .; then126    echo "uncommitted changes - commit before applying"127    exit 1128fi129```130131---132133## multi-machine134135Any command runs on a remote machine with `--on <name>`. Configure machines in `~/.nina.conf`:136137```ini138[machine]139name    = kyoshi140config  = /etc/nixos141local   = true142default = true143144[machine]145name    = azula146host    = azula147user    = june148ssh_key = ~/.ssh/id_ed25519149```150151```152nina apply --on azula153nina service logs ollama -f --on azula154nina status --all155```156157```158:: status159160   kyoshi   gen 348   3m ago    42 GB161   azula    gen 192   14m ago   18 GB162```163164---165166## search that stays at the prompt167168`nina search` opens an inline widget — no fullscreen takeover. Browse results, see versions and licenses, install to your profile or system config, copy the attr name, or try the package in a temporary shell.169170```171:: search nixpkgs  ripgrep                          12 results172173   > ripgrep        14.1.1   free    fast line-oriented search174     ripgrep-all    0.9.6    free    search across file formats175     ugrep          6.0.0    free    grep compatible ripgrep alt176177   ripgrep  14.1.1  free178   recursively search directories for a regex pattern179   attr   pkgs.ripgrep180181   [i] profile  [s] system  [t] try  [c] copy  [esc] exit182```183184---185186## install that actually works187188`nina install` uses `nix search nixpkgs` directly — no external API, no network dependency after your first channel update, no silent failures. Works offline.189190Two install paths, your choice:191192- **profile** — instant. package available immediately. no rebuild.193- **system** — opens your editor at the right line in `configuration.nix`, then offers to apply.194195---196197## config198199`~/.nina.conf` — plain text, no surprises:200201```ini202editor      = hx203generations = 5204confirm     = true205teach       = false206color       = true207208[machine]209name    = my-machine210config  = /etc/nixos211local   = true212default = true213```214215`teach = true` prints the underlying nix command after each operation so you learn while you work.216217---218219## what nina outputs220221```222:: rebuilding kyoshi...223224   -> [build output]225226:: generation 14  [42.3s]227```228229```230:: error: 'firefocks' not found in nixpkgs231   -> try: nina search firefox232```233234Pink `::` marks Nina's voice. Green for success. Red for errors. Yellow for warnings. Color auto-disables when stdout is not a TTY. Respects `NO_COLOR`.235236---237238## built by239240[asha software](https://asha.software) — hope in every line of code.241242**[nina.asha.software](https://nina.asha.software)** · [source](https://kepr.uk/nina) · [docs](https://nina.asha.software/docs)