2018-10-25 13:58:11 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
This file is a test that makes sure that the `pkgs.nixos` and
|
|
|
|
`pkgs.nixosTest` functions work. It's far from a perfect test suite,
|
|
|
|
but better than not checking them at all on hydra.
|
|
|
|
|
|
|
|
To run this test:
|
|
|
|
|
|
|
|
nixpkgs$ nix-build -A tests.nixos-functions
|
|
|
|
|
|
|
|
*/
|
2018-10-02 19:49:54 +00:00
|
|
|
{ pkgs, lib, stdenv, ... }:
|
|
|
|
|
2018-11-19 19:26:52 +00:00
|
|
|
let
|
|
|
|
dummyVersioning = {
|
|
|
|
revision = "test";
|
|
|
|
versionSuffix = "test";
|
|
|
|
label = "test";
|
|
|
|
};
|
|
|
|
in lib.optionalAttrs stdenv.hostPlatform.isLinux (
|
2018-10-02 19:49:54 +00:00
|
|
|
pkgs.recurseIntoAttrs {
|
|
|
|
|
|
|
|
nixos-test = (pkgs.nixos {
|
2018-11-19 19:26:52 +00:00
|
|
|
system.nixos = dummyVersioning;
|
2018-10-02 19:49:54 +00:00
|
|
|
boot.loader.grub.enable = false;
|
|
|
|
fileSystems."/".device = "/dev/null";
|
|
|
|
}).toplevel;
|
|
|
|
|
2018-10-23 15:32:59 +00:00
|
|
|
nixosTest-test = pkgs.nixosTest ({ lib, pkgs, ... }: {
|
|
|
|
name = "nixosTest-test";
|
2018-10-02 19:49:54 +00:00
|
|
|
machine = { pkgs, ... }: {
|
2018-11-19 19:26:52 +00:00
|
|
|
system.nixos = dummyVersioning;
|
2018-10-23 15:32:59 +00:00
|
|
|
environment.systemPackages = [ pkgs.hello ];
|
2018-10-02 19:49:54 +00:00
|
|
|
};
|
|
|
|
testScript = ''
|
2020-02-09 22:49:22 +00:00
|
|
|
machine.succeed("hello")
|
2018-10-02 19:49:54 +00:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
)
|