Skip to content

Add support for NixOS containers#10

Draft
nessdoor wants to merge 2 commits into
svanderburg:masterfrom
nessdoor:nixos-container
Draft

Add support for NixOS containers#10
nessdoor wants to merge 2 commits into
svanderburg:masterfrom
nessdoor:nixos-container

Conversation

@nessdoor
Copy link
Copy Markdown

Native NixOS containers can be a lightweight alternative to the heavier Docker containers, which are already supported by Dysnomia.

The need for this new module stems from the fact that my distributed infrastructure, managed by Disnix, is built upon NixOS hosts with a configuration described by a flake, which is periodically fetched by the hosts according to their automatic update routines. With NixOS containers, it is possible to take advantage of the service definitions provided by Nixpkgs while decoupling the host configuration.nix from the services they provide.
Another use of NixOS containers is as a stop-gap measure for services for which there is still no Dysnomia module.

I tested this addition on my machine but, unfortunately, I couldn't write a test to prove that it works. For some reason, nix-env insists on downloading some data from the Internet even if I supply a fully-built derivation, and Internet connectivity is disabled for test VMs. If anyone knows how to circumvent this, I am open to suggestions.

For this reason, this PR has been opened as a draft. Nonetheless, I included the unit test that I wrote. If you try to run it, you will see that it fails as soon as nix-env attempts to download info about binary caches. If you run all the scripted commands on your local NixOS installation, they will likely succeed.

This comes from the first time we perform the test at line 42 of
nixos-container.in: since the container is not there yet, nixos-container barks
an error, while sending "gone" to stdout (which is what we are interested in).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant