Migrating away from Codchi
One of our main principles is not to lock the user into Codchi. Code machines consist of three parts:
- Configuration (NixOS modules)
- File system state
- The Codchi driver
To migrate away from Codchi just use your existing code machine configuration (1), copy your files (2) and bring your own hardware driver / configuration (3). For development environments this could be a VM. This is how it works in practise:
- Install NixOS in a virtual machine. The easiest way is to use a graphical ISO image.
Use
codchi
as your user name. - Export your code machine with
codchi tar <MACHINE_NAME> my-files.tar
- Copy
my-files.tar
to the VM and extract it:cd / sudo su tar --no-overwrite-dir -xf /path/to/my-files.tar chmod 755 /
- Add the VM configuration to your code machine flake:
sudo nano /etc/nixos/flake.nix
{ inputs = { codchi_driver.url = "github:aformatik/codchi/master"; "codchi-secrets".url = "github:aformatik/codchi?host=github.com"; }; outputs = inputs: { nixosConfigurations.nixos = inputs."codchi-secrets".inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ { _module.args.inputs.nixpkgs = inputs."codchi-secrets".inputs.nixpkgs; codchi.driver.name = "none"; } inputs.codchi_driver.nixosModules.default inputs."codchi-secrets".nixosModules.secrets ./configuration.nix # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< add this line ]; }; }; }
- Now build your system:
sudo nixos-rebuild switch
codchi tar
creates a flake that uses exactly the same modules as the code machine, which means your VM can stay up to date with your code machine when using remote modules. Also Codchi's [custom NixOS options](../3.config/99.Codchi specific NixOS Options.md) will continue to work (without the Codchi host integration, like the GPU). Your secrets and previous machine name are stored in /etc/codchi-env
.
uil:edit Edit this page on GitHub