NixOS VM to OCI container

Hello,

I’ve recently contributed to enhancing a project that my colleagues and I uses at work. The project is accessible at ECPHP / Devs profile · GitLab and it facilitates a straightforward setup for a “default” user profile using home manager. Extending the list of profiles is trivial, requiring only the creation of a directory along with a few files. I’m quite satisfied with it.

At its core, Nix interpret the profiles directory, generating appropriate homeConfigurations and nixosConfigurations. You might be curious about the purpose of nixosConfigurations, considering the project primarily supports home-manager profiles. These NixOS configurations are made for testing purposes. They allow me to build any profile within a virtual machine (qemu) and tests without the necessity of a physical computer.

Moving forward, I’m looking at the next phase of the project, the reason of this message. I aim to extend the capability of my project by generating OCI containers based on profiles. Specifically, I envision creating a NixOS OCI container tailored to a selected profile. Alternatively, converting a nixosConfiguration into an OCI container using dockertools.

I would greatly appreciate any insights, suggestions, or guidance on how to approach this.

Thank you!