How-to guide / Start and inspect a Kix project
Install and run Kix
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
Install Kix with the install script, see how Kix chooses the version of Kix your project uses, and verify that Kix can discover and evaluate your clusters.
Install with the install script
Section titled “Install with the install script”❱ curl -fsSL https://kix.run/install | sh The script downloads the release archive for your platform (x86_64-linux,
aarch64-linux, or aarch64-darwin) from kix.run and checks it against the
release’s signed SHA256SUMS. It unpacks the archive to
~/.local/share/kix/<version>/ and links ~/.local/bin/kix to it. It never
edits your shell startup files. If ~/.local/bin is not on your PATH, the
script prints the line to add.
To install a specific version, set KIX_VERSION to an exact version:
❱ curl -fsSL https://kix.run/install | KIX_VERSION=0.8.3 sh | Variable | Default | Effect |
|---|---|---|
KIX_VERSION | the latest release | The exact version to install, such as 0.8.3, or a prerelease such as 0.9.0-rc.1. A minor such as 0.8 matches no release. The latest release is never a prerelease. |
KIX_INSTALL_DIR | ~/.local/bin | The directory for the kix link. |
XDG_DATA_HOME | ~/.local/share | Kix versions are installed under $XDG_DATA_HOME/kix/. |
The script stops without changing anything if ~/.local/bin/kix already
exists and the script did not create it, for example a kix installed with
Nix. Remove that file, or choose another directory with KIX_INSTALL_DIR.
Choose the version of Kix for a project
Section titled “Choose the version of Kix for a project”By default, a project’s version of Kix is the release tag of the kix input in
its flake.nix, as flake.lock records it:
1inputs.kix.url = "github:kix-run/kix/v0.10.0";This project uses Kix 0.10.0. The tag is the project’s version, so
everyone who works on the project, and every CI job, runs Kix 0.10.0 for it.
kix upgrade --to <version> sets the tag and
writes flake.lock. Commit both files.
A project with a [versions] table
in kix.toml can keep clusters on different versions of Kix, each pinned by its
own input in flake.nix (see
Keep clusters on different versions of Kix).
When you run a command for a cluster, such as kix check prod or
kix deploy prod, Kix looks up that cluster’s input in [versions] and runs
the version pinned for it in flake.lock. Project-wide commands that take no
cluster name (such as kix list clusters, kix doctor, and kix status with
no cluster) use the kix input.
Before Kix parses its arguments, it reads flake.lock. When the selected input
pins the running version, the command runs directly. Otherwise Kix runs that
version from ~/.local/share/kix/<version> in its place, with the same
arguments. When that version is not installed, Kix downloads it from kix.run,
checks its signature and SHA-256, and then runs it:
1Installing Kix 0.10.0 (this project uses 0.10.0)To stop Kix from downloading versions, set KIX_AUTO_INSTALL=0. Kix then
stops and names the command to run:
1This project uses Kix 0.10.0 (flake.lock), and Kix 0.10.0 is not installed. Automatic installs are off (KIX_AUTO_INSTALL=0). Run `kix self install 0.10.0`.kix self, kix upgrade, kix completions,
kix init, kix help, and --help run in the Kix you started. So does a
command in a directory with no flake.nix, or with a remote --flake such as
github:org/repo. Kix reads flake.lock without Nix and without a network
request, so choosing a version is fast.
A project with a flake.nix must have a flake.lock whose kix input pins a
release tag. Kix stops with a message that names the fix when the lock is
missing, when the input has another name, or when the input has no tag. In
each case, run kix upgrade --to <version> to pin the Kix library and write
flake.lock.
kix --version prints the running version and never downloads. On stderr it
adds one line about the project: the Kix that started this one, the project’s
version when it is not installed, or that the project uses a development Kix
library. kix doctor reports the project’s
version of Kix too.
Manage installed versions
Section titled “Manage installed versions”kix self installs, lists, and removes versions
of Kix:
❱ kix self list❱ kix self install 0.8❱ kix self prune❱ kix self upgrade kix self upgrade installs the latest release and moves the kix link the
install script made to it, when the install script installed the running Kix.
When the Kix library does not match Kix
Section titled “When the Kix library does not match Kix”The Kix library and the running Kix match unless flake.nix changed after
flake.lock was written, for example when someone edited the tag by hand.
Kix then stops:
1flake.nix asks for Kix 0.10.1, but flake.lock pins Kix 0.10.0. Run `kix upgrade --to 0.10.1`.Kix compares the two tags before it evaluates anything, so flake.lock stays
as it was. Run kix upgrade --to 0.10.1: it
sets flake.nix back to 0.10.0, builds every cluster with it, then moves the
project to 0.10.1 with the usual builds and release notes. Commit both files.
When the tag names an older version than flake.lock, kix upgrade cannot
help, because it only moves a project to a newer version. Kix says so:
1flake.nix asks for Kix 0.9.2, but flake.lock pins Kix 0.10.0. `kix upgrade` only moves a project to a newer version of Kix. To stay on Kix 0.10.0, set the tag in flake.nix back to v0.10.0. To go back to Kix 0.9.2, restore flake.nix and flake.lock from a commit that pinned it.When Kix cannot find the tag in flake.nix, for example because the input is
written as an attribute set, it still checks after evaluation that the Kix
library has the same version as the running Kix. Installing a version with
kix self install alone does not change which Kix runs, because Kix takes a
project’s version only from flake.lock.
Work on the Kix library itself
Section titled “Work on the Kix library itself”A project uses a development Kix library when its kix input is a local
folder (path:..., or a local git+file:// repository with no ref), a branch,
or an input you replace with
--override-input kix <url>, and when
kix.toml sets library = "self",
as the Kix repository does because its own flake provides the Kix library. In a
project with a [versions] table,
pointing an input at a local folder or branch (or passing
--override-input <input> <url>) uses a development Kix library only for the
clusters on that input, while other clusters keep their pinned versions. A
development Kix library has no release version, so Kix runs the Kix you started
and compares no versions. It prints one line on stderr:
1note: this project uses a development Kix library (the input kix is the local folder /home/me/src/kix), so Kix 0.10.0 runs it without checking its version.Verify the installation
Section titled “Verify the installation”Check the installed version:
❱ kix --version
kix 0.10.0-rc.6 Verify that Kix and its runtime tools are healthy:
❱ kix doctor Confirm that the command list is available:
❱ kix --help Run your first command
Section titled “Run your first command”Kix evaluates the project in the current directory unless you pass --flake.
From a Kix project, list the clusters it defines:
❱ kix list clusters If the project is in another directory, pass --flake:
❱ kix --flake /path/to/project list clusters By default (builder = "kix"), Kix evaluates with the Kix runtime and
downloads the project’s locked inputs into Kix’s local store
(~/.cache/kix/store, or $XDG_CACHE_HOME/kix/store). Later commands reuse
the cached inputs. Set KIX_STORE_ROOT if you want Kix to keep its local store
in a different directory.
A project can instead use the Nix already installed on the machine. See
kix.toml.
Install from a release archive
Section titled “Install from a release archive”Where you cannot run the install script, such as in a container image build,
download a release archive yourself. Replace 0.8.4 with the version you
want, and x86_64-linux with aarch64-linux on ARM64 Linux or
aarch64-darwin on Apple silicon macOS:
❱ curl -fsSLO https://kix.run/download/0.8.4/kix-x86_64-linux.tar.gz❱ curl -fsSL https://kix.run/releases/v0.8.4/SHA256SUMS | grep ' kix-x86_64-linux.tar.gz$' | sha256sum -c -❱ mkdir -p ~/.local❱ tar -xzf kix-x86_64-linux.tar.gz --strip-components=1 -C ~/.local On macOS, check the archive with shasum -a 256 -c - in place of
sha256sum -c -. Make sure ~/.local/bin is on your PATH.
kix self upgrade does not upgrade a Kix installed this way. A project still
gets the version of Kix its flake.lock names, which Kix installs under
~/.local/share/kix/.
Install with Nix
Section titled “Install with Nix”If you manage tools with Nix flakes, you can install Kix from its flake:
❱ nix profile install github:kix-run/kix#kix Upgrade it with nix profile upgrade kix. kix self upgrade prints that
command instead of upgrading a Kix installed this way.