Skip to content

Instantly share code, notes, and snippets.

@fpletz
Created June 19, 2020 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fpletz/520b41f9b2ef92acf07a5d3242869d30 to your computer and use it in GitHub Desktop.
Save fpletz/520b41f9b2ef92acf07a5d3242869d30 to your computer and use it in GitHub Desktop.
NixOS module test skeleton
{ config, lib, ... }:
with lib;
let
cfg = config.foo.bar;
in
{
options.foo.bar = {
enable = mkEnableOption "foobar";
};
config = mkIf cfg.enable {
# ...
};
}
{ system ? builtins.currentSystem
, pkgs ? import <nixpkgs> { inherit system; }
}:
with import <nixpkgs/nixos/lib/testing-python.nix> { inherit system pkgs; };
{
mytest = makeTest {
machine = { ... }: {
imports = [ ./module.nix ];
virtualisation.cores = 4;
virtualisation.memorySize = 1024;
foo.bar.enable = true;
};
testScript = ''
machine.start()
'';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment