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
- Host: GitHub
- URL: https://github.com/jonringer/nixos-polytest
- Owner: jonringer
- License: mit
- Created: 2024-06-07T01:40:00.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T16:58:14.000Z (almost 2 years ago)
- Last Synced: 2025-04-12T03:14:24.379Z (about 1 year ago)
- Language: Nix
- Homepage:
- Size: 36.1 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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";
}];
};
};
};
}
```