Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/documentation request: testing story #79

Open
shanesveller opened this issue Nov 25, 2022 · 0 comments
Open

Feature/documentation request: testing story #79

shanesveller opened this issue Nov 25, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@shanesveller
Copy link

Preface: I am a fairly casual nixpkgs contributor thus far and have not submitted any NixOS modules or tests upstream, and in general I am woefully unfamiliar with my opportunities and available techniques to test Nix code in any context. I know there's some prior art for me to review in the form of the NixOS testing support, and that's about all I know today.

As mentioned elsewhere, I'm working on my first non-trivial flake intended for public consumption, and it's defined in terms of a flake-parts module. I'd like to keep a few common permutations around in-repo and evaluate them with/against my current flakeModule content to prove that they still work as intended and check some simple results. Is this something that I can do today? Would such an approach be best based around lib.evalFlakeModule?

Early motivating examples of "unit tests" I'd like to incorporate are:

  • If I set a particular option defined by my flakeModule, does a particular leaf node of config hold an expected value?
  • If I set a particular option defined by my flakeModule, does the consuming flake now have an output at a particular path?

Later on it would be cool to also check things like:

  • Is such-and-such binary in PATH in the generated devShell?
  • Does a particular shell command produce expected output when run in the context of the devShell?

As with #77, if some early guidance is available I'd be happy to try to implement this myself. I am not always able to deeply comprehend some of the more sophisticated code in the Nix ecosystem without assistance - my functional-programming background begins and ends with Elixir.

@roberth roberth added the enhancement New feature or request label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants