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 check           validate config without switching92nina fmt             format nix files93nina info            nixos version, kernel, uptime94nina boot            boot entries9596nina help            all commands97nina --version       version info98```99100---101102## hooks103104Nina runs optional executable hook scripts before and after state-changing commands.105Create them in `~/.config/nina/hooks/`:106107```108pre-apply     post-apply109pre-back      post-back110pre-home      post-home111pre-upgrade   post-upgrade112```113114Missing hooks are ignored. Hook files must be executable (`chmod +x`) to run.115If a pre-hook exits non-zero, Nina shows the last five output lines and asks116whether to continue, defaulting to no. If a post-hook exits non-zero, Nina shows117a warning after the command's success line.118119Example: stop `nina apply` when your config has uncommitted changes.120121```sh122#!/usr/bin/env sh123# ~/.config/nina/hooks/pre-apply124if git -C ~/nixos-config status --porcelain | grep -q .; then125    echo "uncommitted changes - commit before applying"126    exit 1127fi128```129130---131132## multi-machine133134Any command runs on a remote machine with `--on <name>`. Configure machines in `~/.nina.conf`:135136```ini137[machine]138name    = kyoshi139config  = /etc/nixos140local   = true141default = true142143[machine]144name    = azula145host    = azula146user    = june147ssh_key = ~/.ssh/id_ed25519148```149150```151nina apply --on azula152nina service logs ollama -f --on azula153nina status --all154```155156```157:: status158159   kyoshi   gen 348   3m ago    42 GB160   azula    gen 192   14m ago   18 GB161```162163---164165## search that stays at the prompt166167`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.168169```170:: search nixpkgs  ripgrep                          12 results171172   > ripgrep        14.1.1   free    fast line-oriented search173     ripgrep-all    0.9.6    free    search across file formats174     ugrep          6.0.0    free    grep compatible ripgrep alt175176   ripgrep  14.1.1  free177   recursively search directories for a regex pattern178   attr   pkgs.ripgrep179180   [i] profile  [s] system  [t] try  [c] copy  [esc] exit181```182183---184185## install that actually works186187`nina install` uses `nix search nixpkgs` directly — no external API, no network dependency after your first channel update, no silent failures. Works offline.188189Two install paths, your choice:190191- **profile** — instant. package available immediately. no rebuild.192- **system** — opens your editor at the right line in `configuration.nix`, then offers to apply.193194---195196## config197198`~/.nina.conf` — plain text, no surprises:199200```ini201editor      = hx202generations = 5203confirm     = true204teach       = false205color       = true206207[machine]208name    = my-machine209config  = /etc/nixos210local   = true211default = true212```213214`teach = true` prints the underlying nix command after each operation so you learn while you work.215216---217218## what nina outputs219220```221:: rebuilding kyoshi...222223   -> [build output]224225:: generation 14  [42.3s]226```227228```229:: error: 'firefocks' not found in nixpkgs230   -> try: nina search firefox231```232233Pink `::` 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`.234235---236237## built by238239[asha software](https://asha.software) — hope in every line of code.240241**[nina.asha.software](https://nina.asha.software)** · [source](https://kepr.uk/nina) · [docs](https://nina.asha.software/docs)