# nixosTest with flake configurations

**URL:** https://discourse.nixos.org/t/nixostest-with-flake-configurations/11542
**Category:** Uncategorized
**Created:** [February 15, 2021, 8:28pm UTC](https://discourse.nixos.org/t/nixostest-with-flake-configurations/11542 "2021-02-15T20:28:20Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![juuso](https://discourse.nixos.org/user_avatar/discourse.nixos.org/juuso/32/7852_2.png) [@juuso](https://discourse.nixos.org/u/juuso)
#### Post date: [March 25, 2025, 10:18am UTC](https://discourse.nixos.org/t/nixostest-with-flake-configurations/11542/8 "2025-03-25T10:18:00Z")

</div>

This thread shows up on Google, so responding for future reference: the `nixosTest` function is being deprecated as of 2024: [testers.nixosTest: Deprecate by roberth · Pull Request #293891 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/pull/293891)

Instead, `runNixOSTest` should be used, which coincidentally makes working with nixosConfigurations easier. This tester specifically helps you with the pkgs argument, which it tries to derive automatically. And, if you have overlay applied in your flake, you can use `node.pkgsReadOnly = false;` to pass the overlayed pkgs definition into your test.

A full example here with flake.parts: [flake: add nixos tests by jhvst · Pull Request #92 · ponkila/homestaking-infra · GitHub](https://github.com/ponkila/homestaking-infra/pull/92/files)  
Moreover, in the diffset above, it’s possible to test a nixosConfiguration by doing a let binding for a `nixosSystem` before opening the flake schema. Take a look at the rest of the PR flake.nix for an example `ponkila-ephemeral-sigma`. You can test the full host by defining the `imports = ponkila-ephemeral-sigma.modules;` inside of the testable machine.

---

_[View the full topic](https://discourse.nixos.org/t/nixostest-with-flake-configurations/11542)._
