codchi module

Manage modules of code machines.

Synopsis

codchi module [-v|--verbose]... [-q|--quiet]... [--json] [-h|--help] <subcommands>

Description

Each code machine has a list of modules (often just one) which are identified by a name. There can also be machines without modules (a base machine). You can add, modify, remove a module or switch a module between local and remote configuration.

Subcommands

  • codchi-module-list(1)

    Lists modules of a code machine

  • codchi-module-add(1)

    Add a module to a code machine.

  • codchi-module-set(1)

    Modify a module of a code machine.

  • codchi-module-delete(1)

    Delete a module of a code machine

Options

  • -v, --verbose

    Increase logging verbosity

  • -q, --quiet

    Decrease logging verbosity

  • --json

    Produce output in JSON format, suitable for consumption by another program

  • -h, --help

    Print help (see a summary with -h)

Extra

Local Configuration

While working on a code machine module, any change to the code must first be pushed online before Codchi can pull and apply the change. This can quickly become annoying, especially if you're actively developing the module or experimenting a lot. Luckily, a machine module can be switched to local repository inside the code machine.

It's good practise to have the .nix configuration files in the repository of your project itself. This way Codchi can spin up a machine for every commit of your project. Also you'll have the project checked out in your code machine anyway, so step 1 shouldn't be neccessary.

  1. First of all, clone the repository containing the module configuration inside . For Codchi to be able to find it, the repository has reside in a folder inside the machine's $HOME, which is /home/codchi.

    git clone https://github.com/my/repo ~/my-project-name
  2. Upon creation of , if you didn't explicitly specify a module name for your repository, Codchi guesses a name from its url. List 's modules to get the actual module name:

    codchi module list <MACHINE_NAME> ┌─────────────┬────────────────────┬────────────────────────┐ │ Name ┆ Url ┆ Flake Module │ ╞═════════════╪════════════════════╪════════════════════════╡ │ repo-module ┆ github.com/my/repo ┆ nixosModules.my-module │ └─────────────┴────────────────────┴────────────────────────┘
  3. Now you can tell Codchi to switch the module pointing to the remote repository to your local copy. Note that that `my-project-name' is the path inside relative to $HOME:

    codchi module set <MACHINE_NAME> <MODULE_NAME> --url=my-project-name

If you don't already have a module (e.g. after creating a base machine), you can just add a module pointing to a local repository. The name of the new module will be inferred by Codchi:

codchi module add <MACHINE_NAME> my-project-name