An open API service indexing awesome lists of open source software.

https://github.com/jonringer/nixos-polytest

Allow you to evaluate many nixos closures from different points in time
https://github.com/jonringer/nixos-polytest

Last synced: about 1 year ago
JSON representation

Allow you to evaluate many nixos closures from different points in time

Awesome Lists containing this project

README

          

# NixOS Polytest

Allow for multiple nixpkgs evaluations within a "runTest" like environment

## Minimal example

```nix
{
description = "Example poly nixpkgs tests";

inputs = {
nixpkgs-2311.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-2405.url = "github:nixos/nixpkgs/nixos-24.05";
poly-test.url = "github:jonringer/nixos-polytest";
};

outputs = { nixpkgs-2311, nixpkgs-2405, poly-test, self }: let
# This can be a linux or darwin system
hostPkgs = import nixpkgs-2311 { system = "x86_64-linux"; };
runPolyTest = poly-test.lib.mkRunPolyTest hostPkgs;
in {
checks.x86_64-linux.example = runPolyTest {
name = "example-polytest";

testScript = ''
start_all()
foo.wait_for_unit("multi-user.target")
bar.wait_for_unit("multi-user.target")

foo.succeed("grep 23.11 /etc/os-release")
bar.succeed("grep 24.05 /etc/os-release")
'';

nodes.a = {
nixpkgsPath = toString nixpkgs-2311;
specialArgs = { };
modules = [ {
system.name = "foo";
}];
};

nodes.b = {
nixpkgsPath = toString nixpkgs-2405;
specialArgs = { };
modules = [ {
system.name = "bar";
}];
};
};
};
}
```