mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-24 17:23:09 +01:00
95b10ec3ef
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/
14 lines
284 B
Nix
14 lines
284 B
Nix
test: { pkgs, self }:
|
|
let
|
|
inherit (pkgs) lib;
|
|
nixos-lib = import (pkgs.path + "/nixos/lib") { };
|
|
in
|
|
(nixos-lib.runTest {
|
|
hostPkgs = pkgs;
|
|
defaults.documentation.enable = lib.mkDefault false;
|
|
node.specialArgs = {
|
|
inherit self;
|
|
};
|
|
imports = [ test ];
|
|
}).config.result
|