Commit Graph

3 Commits

Author SHA1 Message Date
Donovan Glover
41ce56718b
chore: Simplify tests
Removes the redundant `self`.
2024-04-05 11:53:40 -04:00
Donovan Glover
59f557a3e5
feat: Pass nix-config as self to avoid infinite recursion
This change makes it possible to use this nix-config in all the
different ways imaginable (containers, bare metal, tests, and as a
separate flake input) *without* running into infinite recursion
issues with self.

It does this by using a trick similar to JavaScript in which
`var self = this;`, thus enabling the usage of "this" (or self, in
Nix's case) where it wouldn't otherwise be possible.

Note that this *only* works if the input for this repository is named
nix-config. This makes it impractical to combine with multiple
configurations that employ the same strategy.
2024-04-05 10:20:06 -04:00
Donovan Glover
95b10ec3ef
meta: Begin writing tests in Nix
Now that I've figured out how to dynamically import modules and use
those modules as outputs, the next step is to ensure that these modules
work as intended when being used by end users.

NixOS offers a built-in testing solution that enables us to conveniently
spin up virtual machines with a given configuration, then verify their
correctness through python scripting.

The lib.nix file in particular is based on Jörg Thalheim's very useful
blog post that explains how to use the built-in testing functionality
with Nix flakes, which isn't covered in official documentation.

See: https://blog.thalheim.io/2023/01/08/how-to-use-nixos-testing-framework-with-flakes/
2024-04-02 05:20:42 -04:00