Add support for NixOS containers#10
Draft
nessdoor wants to merge 2 commits into
Draft
Conversation
Module + tests
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.nixfrom 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-envinsists 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-envattempts to download info about binary caches. If you run all the scripted commands on your local NixOS installation, they will likely succeed.