nina

@june

NixOS is powerful, but it can be a lot. Nina keeps the whole workflow — packages, options, rebuilds, services, remote machines — right at the prompt.

https://nina.asha.software

Zig

v3.4.14 · 229 saves · 10,620 lines · updated 1 week ago

22 files
d55b75fe962b
back to HEAD
be1fa5647d2binstall: select #nina attr so nix names the element 'nina' (revert bogus --name flag which does not exist); install.sh was using the bare URL -> default attr -> full-URL name4 months ago9a21e1202972install: name the profile element 'nina' via 'nix profile add --name nina' in README + install.sh — raw tarball URLs otherwise get the full installable string as the element name4 months ago63c01c28ec41update: stop telling flake/module installs to 'nix profile add' — rename updateSelfNotInProfile to updateSelfSystemManaged, point at nix flake update + rebuild4 months ago87c400b2aab3CONTINUITY: correct regression provenance — v3.2.6 [9a7b9486f3f3] switched upgrade arg from element name to URL; <=3.2.5 updated fine4 months ago893231d4350afix nina update reporting success on no-op nix profile upgrade: match by element name not URL, detect nix's exit-0 no-op via nixUpgradeNoOp, drop dead originalUrl machinery4 months ago7b3809e8339aread only canonical 'notes' field in releaseNotesFromMetadata; drop release_notes/changelog fallbacks; v3.4.14 months agod7e14c6e0d10kohignore: drop duplicate /.claude/ entry auto-added by koh strip4 months agod26f28ec5669kohignore: ignore .claude/ agent session state4 months ago50b5e9dbbde9document v3.4.0 real-tool golden verification in CONTINUITY — 9/9 PASS, HM platform-attr fallback chain proven against real home-manager+flakes4 months ago347af6fd7c58document murazaki feedback session (v3.4.0) in CONTINUITY — HM platform attr fallback chain, edit --dir, edit hardware warning, store optimise4 months ago5348d2aa7419docs: note nina edit --dir in README command cheatsheet4 months agoa18ff8499213bump version to v3.4.0 — ships HM platform-attr flake ref, edit --dir, edit hardware warning, store optimise4 months agob8edd2a2e22dstore: add nina store optimise (deduplicates store with hard links), accept optimize alias4 months agof1282c9a5b31edit: remove hardware subcommand, warn that hardware-configuration.nix is auto-generated4 months ago8787be42c8d9edit: add --dir flag to open config directory instead of file4 months ago2f0d457a97bahome: detect platform-specific attr (user-arch-os) with fallback chain for home-manager flake ref4 months ago7acbc7250302changelog: use oldest save per version to show version-intro message, not follow-up CONTINUITY updates (v3.3.1)4 months agod90a1016c675home init: record REAL network VM verification (init + --switch gen 1) pass in CONTINUITY4 months agob80d8ca4cbcbhome init: record golden VM verification 9/9 pass (v3.3.0) in CONTINUITY4 months ago3912f93017a4home init: nina home init generates HM config, --switch activates, warns if already exists (v3.3.0)4 months ago9a7b9486f3f3fix: nix update uses originalUrl as installable, add hash -r hint (v3.2.6)4 months ago2e6bd97e4fc0fix: progress bar tracks copies, error pipeline catches service activation failures (v3.2.5)4 months ago63f60ea4c5c0fix: Render update changelog fallback (v3.2.4)4 months ago9a3229ca965fupgrade: live build panel during rebuild phase4 months ago8e8ad66cbc0aapply: live build panel — single name slot, cyan/yellow/green bar, fetch/build/activate phases, non-TTY suppressed; bump v3.2.34 months agoa04f62111174errors: expanded translation table (25 patterns + home manager), 3-layer pipeline, warning extraction; output: buildError + buildWarnings; exec: capture nixos-rebuild stderr; main: route BuildFailed through pipeline; bump v3.2.24 months ago636dfd11f624verify hooks: 18/18 pass on golden-unstable (v3.2.1)4 months ago6ba802b79f6dfix: pre-hook abort returns error.HookAborted for non-zero exit; bump v3.2.14 months ago7d715ad938a1fix: nina back uses switchGeneration on flake systems, not --rollback4 months ago738c20da084everify hooks: record golden failures (v3.2.0)4 months ago1974f3b85d9dfeat: Add lifecycle hooks for state-changing commands (v3.2.0)4 months agob06dca45c445document v3.1.9 nina update verification in CONTINUITY — changelog + self-update-completion confirmed working (build/test green, HTTP-fixture check/download/checksum paths exercised); credits GPT 5.4 Mini for the code, Opus 4.8 for the verification4 months ago0695035b0f43fix: Surface successful self-update completion (v3.1.9)4 months ago669fea798465feat: Show release changelog in nina update (v3.1.6)4 months agoa178ca844c84pkg commands: resolve as nixpkgs#name consistently — fixes why/deps/size/closure on flake systems (v3.1.5)4 months agoa512584d3c19docs: record kyoshi try/develop prompt smoke verification4 months ago570595053bddtry + develop: branded PS1 prompt and exit instruction (v3.1.4)4 months agob32f051a7897document v3.1.3 cleanups in CONTINUITY — ./result litter fix, useFlakeFlag trailing-slash normalization, golden home.nix enableNixpkgsReleaseCheck, module-mode verified live (5/5 PASS on golden); all open code-review items now fixed-and-verified or documented non-defects4 months agocc6de0e806d9fix remaining open code-review items, bump v3.1.3 — (LOW) home-manager build no longer litters ./result in the cwd: homeManagerBuild now runs 'sh -c d=$(mktemp -d) && cd "$d" && home-manager build' (affects home check + home apply --dry). (LOW) useFlakeFlag trims trailing slashes before the /etc/nixos comparison so '/etc/nixos/' is still treated as the default (no spurious --flake). Golden fixture: home.nix sets home.enableNixpkgsReleaseCheck=false (master tracks unstable; the 26.05-vs-26.11 mismatch warning is spurious) — applies on next rebake. Verified on the golden: no ./result after check/apply--dry, module-mode dispatch redirects to 'nina apply' (closes the last verification gap), normal home apply + check still work. Confirmed-correct non-defects left as-is (seen.put dedup, parseHomeGenerations empty-path guarded at call sites). VERSION/zon -> 3.1.3, build+tests green4 months ago60b58bedad52document rebake + channel-paths + kyoshi read-only + code-review pass (v3.1.2) in CONTINUITY — rebaked & promoted kiln/golden-unstable.qcow2 (nixPath fix + v3.1.2 nina); channel paths 4/4 PASS on the golden (channel doctor ok, channel list no flake note, apply --dry plain dry-activate, flake doctor still ok); kyoshi read-only suite clean on real unstable channel hardware with fully isolated HOME (nothing disturbed); code-review fixed HIGH (home local-only) + MED (gen-0), other findings noted4 months agobe755c08c166fix code-review HIGH: home commands are local-only, bump v3.1.2 — home detection (binary, ~/.config/home-manager, $HOME/$USER flake ref) all read the LOCAL host while exec routes over SSH for a remote machine, so 'nina home --on <remote>' would decide mode/flake-ref from the wrong box. Now home() refuses a non-local machine with output.homeLocalOnly. Also (MED) homeApplyDone prints 'done' instead of 'generation 0' when the post-switch gen re-read fails (switch still succeeded). VERSION/zon -> 3.1.2. Verified on mac: 'home apply --on remotebox' -> local-only refusal; local 'home apply' unaffected. build+tests green4 months agoa96eade6fa9cdocument v3.1.1 fixes in CONTINUITY — finding 1 (home packages descend into home-manager-path env + dedup) and finding 2 (doctor config-syntax: root cause 'nixos-config not in NIX_PATH', nina fix = flake-aware dry-build, golden fix = restore nixos-config to nix.nixPath in configuration-unstable.nix; golden not yet re-baked so channel-style doctor on /etc/nixos still fails until rebuild). Both nina fixes verified real on the unstable golden4 months ago155ea1de2442home packages + flake-aware doctor fixes, bump v3.1.1 — (1) home packages now descends into the '…-home-manager-path' env (findHomeManagerPath finds it among the generation's refs and lists ITS references) instead of listing the generation's own activation deps, so the user's home.packages (hello, jq) show and bash/coreutils no longer leak; dedup by name collapses multi-output dups (jq/jq-lib). (2) doctor's config-syntax check is now flake-aware like apply/upgrade — runs 'nixos-rebuild dry-build --flake <config>' when the config dir has a flake.nix, fixing the spurious 'config syntax fail' on flake systems (plain dry-build needs <nixos-config> and fails). VERSION+zon -> 3.1.1. Verified on the unstable golden: home packages -> hello+jq(once), no bash; flake doctor -> config syntax ok / all good. build+tests green incl findHomeManagerPath test4 months agoa57888937a6edocument enriched nixos-unstable golden + real-tool verification in CONTINUITY — built kiln/golden-unstable.qcow2 (NixOS 26.11pre, flakes + baked home-manager channel + /root/nixos-config flake fixture); 10/11 PASS verifying v3.1.0 against REAL home-manager (apply/switch gen1+gen2, back/rollback, history, diff-closures, status hm line, doctor row) and REAL flake dry-activate --flake. Two findings: (1) home packages lists the generation's activation deps not the user's home.packages (should list the home-manager-path env's refs), (2) doctor 'config syntax fail' pre-existing. Harness: build-golden-unstable.sh parses the new unstable ISO boot layout (kernel/initrd under boot/nix/store, dual kernels). Artifacts in koh-ignored test/vm + kiln4 months ago1b8fbce38ab4document golden-VM verification of v3.1.0 flake+HM in CONTINUITY — 41/41 PASS on a throwaway overlay of kiln/golden.qcow2 (NixOS 24.11). Golden is the May-29 image (flakes disabled, no home-manager), so the test PATH-shims sudo/nixos-rebuild/nix/nix-channel/nix-store/home-manager to assert nina's exact constructed argv + drive the full home suite, with real checks for version/help/hello/wizard/no-HM gating. Verified: flake-aware apply --flake gating (added for non-default flake dir, omitted for /etc/nixos even with flake.nix, omitted for channel), channel flake-note, upgrade flake-vs-channel branch, home apply/back/history/check/diff/packages/edit, status+doctor HM rows. On-disk artifacts (test/ is koh-ignored): test/vm/tests/v31-flake-home.sh, test/vm/run-once.sh (single-send driver — run-in-vm.sh's 2nd send is swallowed on this golden), test/vm/results/v31-flake-home.txt. Still needs a flake-enabled + HM golden for the real external tools4 months ago5a395ec7b4ccdocument flake + home manager session in CONTINUITY: 15 saves to v3.1.0, what's host-verified vs needs VM (flake/HM env), and the 'nina update' self-updater divergence from the brief's Part 3 (channel/flake branch placed in upgrade)4 months ago105a19163c99bump version to v3.1.0 — VERSION 3.0.24->3.1.0 and build.zig.zon to match; minor bump for the new 'nina home' command surface and the changed flake-aware behavior of apply/upgrade/setup; nina --version confirms v3.1.0, build+tests green4 months agod6ff1e3add5ahelp: add home manager commands — 'home home manager subcommands' row added to nina help; hello cheatsheet now features home apply / home back / home history; verified help renders the home row; build+tests green4 months agod7d4dc71a0easetup wizard: scan for config and flake.nix, smart defaults — firstRunWizard now scans /etc/nixos (scanConfig: flake.nix -> flake, configuration.nix -> channel, else none), reports the detection, and pre-fills the config-path prompt (output.firstRunPromptDefault, [default] enter-to-confirm); flake-ness is re-detected at the chosen path via exec.dirHasFlake and written as 'flake = true' — never asked. Dropped the [1]/[2] manage-type question and the local prompt (defaults local=true); removed now-dead firstRunManageType. exec.pathExists made pub, configHasFlake refactored onto dirHasFlake. Verified both branches: plain dir -> no flake line; dir with flake.nix -> flake=true. build+tests green4 months agof41c183586eaupdate/upgrade: auto-detect flake vs channel and use correct path — nina upgrade now updates flake inputs (exec.flakeUpdateAt: cd config dir && nix flake update) on a flake system instead of nix-channel --update, then rebuilds (rebuild already flake-aware); channel path unchanged for channel systems. NOTE: in this codebase 'nina update' is the kepr binary self-updater, so the channel-vs-flake branch lives in 'upgrade' (the channel-update+rebuild command); flake-system note for plain channel ops is shown by 'nina channel'. build+tests green4 months ago

← newerolder →

details

nina

Nina is a command-line helper for NixOS. Use it to find packages, apply your configuration, roll back a generation, or check another machine over SSH.

nina search ripgrep
nina apply
nina back
nina status --all

It calls the Nix tools you already use and gives common tasks shorter names. Your configuration stays in Nix files. Nina is written in Zig and builds as a single binary with no third-party Zig dependencies; it needs Nix and the relevant system tools to carry out commands.

Install

Nina's system commands are for NixOS. Package and development commands use Nix, which needs the nix-command and flakes experimental features enabled.

Install in your user profile:

nix profile add 'https://kepr.uk/nina/archive/HEAD.tar.gz#nina'

Then run:

nina setup

Setup creates Nina's configuration if it is missing and checks the required Nix features. On NixOS, it offers to add the setting to /etc/nixos/configuration.nix; you must rebuild for it to take effect. If the install command above fails because these features are disabled, enable them in Nix first.

To build from source, you need Zig 0.16:

koh steal kepr.uk/nina
cd nina && zig build -Doptimize=ReleaseFast
sudo cp zig-out/bin/nina /usr/local/bin/nina

You can also download a source archive from releases:

tar xf nina-*.tar.gz && cd nina-*/
zig build -Doptimize=ReleaseFast
sudo cp zig-out/bin/nina /usr/local/bin/nina

nina goodbye uninstalls Nina. Run nina update to check for a newer Nina release. If your system configuration manages Nina, update it through that configuration.

Apply a configuration

nina edit opens configuration.nix in your editor. Check it before applying, or build it without switching:

nina edit
nina check
nina apply --dry
nina apply

Nina also supports flake-based system configurations. Set the machine's config directory to the directory containing your configuration.

If you need to go back, use nina back. To choose a specific generation, find its number with nina history, then run nina go <n>.

Command What it does
nina history Lists system generations
nina back Rolls back one generation
nina go <n> Switches to generation <n>
nina diff Compares generations
nina upgrade Updates Nix inputs or channels and rebuilds
nina clean Removes old system generations and collects garbage

nina clean keeps the number of generations set in your config, five by default. Removing generations means you can no longer roll back to them.

Find and use packages

nina search <q> searches nixpkgs through nix search. In a terminal, results appear in an inline browser. Use the arrow keys to move, Tab for package details, Enter to select a package, and Escape to cancel. When stdin is not a terminal, search prints a plain list.

nina search ripgrep
nina install ripgrep
nina try ripgrep
nina remove ripgrep
nina list

Selecting a package in search or running nina install asks how you want to use it:

  • Install it in your user profile without a system rebuild.
  • Add it through your system configuration: Nina opens the editor at the package list and offers to apply your changes.
  • Try it in a temporary shell without installing it.

Search and installation may need network access to fetch Nix inputs or packages. nina option <q> searches NixOS options.

Home Manager

Nina supports standalone Home Manager and Home Manager integrated into a NixOS configuration. To create a standalone configuration:

nina home init

Add --switch to activate it immediately. Nina chooses a Home Manager branch from your NixOS version and leaves an existing configuration in place.

Command What it does
nina home apply Applies your home configuration
nina home back Rolls back one home generation
nina home history Lists home generations
nina home edit Opens home.nix
nina home check Builds the home configuration without switching
nina home diff Compares the latest two home generations
nina home packages Lists packages in the home generation

When Home Manager is part of your NixOS configuration, nina home apply runs a system rebuild. Home commands operate on the local user; they do not support --on.

Configure Nina

Nina reads ~/.config/nina/config, or $XDG_CONFIG_HOME/nina/config when that environment variable is set.

editor      = hx
generations = 5
confirm     = true
teach       = false
color       = true

[machine]
name    = my-machine
config  = /etc/nixos
local   = true
default = true

Set editor to your preferred editor. generations controls how many system generations cleanup keeps. With teach = true, Nina prints the underlying commands as you work.

Nina disables color when stdout is not a terminal and respects NO_COLOR.

Work on another machine

Add a machine with an SSH host to your config:

[machine]
name    = azula
host    = azula
user    = june
ssh_key = ~/.ssh/id_ed25519

Put --on <name> after the command to select it:

nina apply --on azula
nina service logs ollama -f --on azula
nina status --all

Remote system operations use SSH and the tools on the target machine. nina status --all checks every configured machine. Use nina hello to list them.

Run hooks

Place executable scripts in ~/.config/nina/hooks/ to run before or after these operations:

pre-apply     post-apply
pre-back      post-back
pre-home      post-home
pre-upgrade   post-upgrade

Missing or non-executable hooks are skipped. If a pre-hook fails, Nina shows its last five output lines and asks whether to continue, defaulting to no. A failed post-hook produces a warning after the operation succeeds. Hooks run locally, including when the operation targets a remote machine.

For example, save this as ~/.config/nina/hooks/pre-apply to check for uncommitted changes, then make it executable with chmod +x:

#!/usr/bin/env sh
# ~/.config/nina/hooks/pre-apply
if git -C ~/nixos-config status --porcelain | grep -q .; then
    echo "uncommitted changes - commit before applying"
    exit 1
fi

More commands

Command What it does
nina status Shows machine health
nina doctor Checks for common problems
nina log Shows Nina's operation history
nina service list Lists systemd services
nina service logs <s> Reads a service's journal
nina service start/stop/restart <s> Controls a service
nina flake show Shows flake outputs
nina flake update Updates flake inputs
nina pin <in> <rev> Pins a flake input to a revision
nina unpin <in> Updates a pinned input
nina develop Enters a development shell
nina build Builds a flake output
nina run <p> Runs a package
nina edit --dir Opens the configuration directory
nina fmt Formats the system configuration
nina info Shows system information
nina boot Lists boot entries

Run nina help for the full command list, nina <group> help for a group such as home or service, and nina man [topic] for the built-in manual. nina --version prints the installed version.

Build and test

From the source directory:

zig build
zig build test
zig fmt --check build.zig src/*.zig

System operations need a NixOS host for live testing. The VM test harness describes testing against disposable NixOS images.

Made by Asha Software.

Website · Source · Documentation