[Nix-dev] How to access makeTest function from nixpkgs/nixos/lib/testing.nix?

Maarten Hoogendoorn maarten at moretea.nl
Thu Jun 23 02:10:58 CEST 2016


Hi Tomasz,

Some weeks ago, I looked into this to run zfs integration tests for a rust
binding to libzfs.

The GitHub repository [1] is set up to run a qemu vm on Travis, so that my
tests can run with a kernel that supports zfs. It also provides some
isolation during development. I'd rather not destroy my main pool by
accident ;)

Good luck, and let me know if this helps you out :)
Maarten

[1] https://github.com/moretea/rust-zfs

2016-06-23 1:23 GMT+02:00 Tomasz Czyż <tomasz.czyz at gmail.com>:

> Hello,
>
> I found makeTest function from nixos useful and I would like to use it in
> my projects for building integration testing environments.
>
> The only method I found by now, how to access it is:
>
> (import <nixpkgs/nixos/lib/testing.nix>).makeTest
>
> The problem is: in the script I'm running, the fixed nixpkgs version is
> passed as "pkgs" argument. The script must test programs against that
> specific nixpkgs version.
>
> I see two options:
> 1. grab makeTest command from pinned nixpkgs
> 2. grab makeTest from <nixpkgs> and pass pinned nixpkgs as argument to
> makeTest (and further to machine/nodes).
>
> 1. I couldn't find the attribute which is pointing to that function or
> file, if looks like I can access it only using path syntax like
> <nixpkgs/nixos/lib/testing.nix>. Is there any way to get path for current
> "pkgs" set? Or are there any other ways how I can access this file/function?
>
> 2. I didn't find any way to pass pkgs argument down the stack, looks like
> other funtions inside makeTest are just importing pkgs from "local" files
> so probably this way won't work.
>
> 3. I could copy the files and bind them to attributes but I prefer to
> avoid that if possible.
>
> If anyone have some suggestions please let me know.
>
> Tom
>
> --
> Tomasz Czyż
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160623/290fc87b/attachment.html>


More information about the nix-dev mailing list