Created
June 19, 2020 09:05
-
-
Save fpletz/520b41f9b2ef92acf07a5d3242869d30 to your computer and use it in GitHub Desktop.
NixOS module test skeleton
This file contains 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
{ config, lib, ... }: | |
with lib; | |
let | |
cfg = config.foo.bar; | |
in | |
{ | |
options.foo.bar = { | |
enable = mkEnableOption "foobar"; | |
}; | |
config = mkIf cfg.enable { | |
# ... | |
}; | |
} |
This file contains 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
{ 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