You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 currentflakeModule
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 aroundlib.evalFlakeModule
?Early motivating examples of "unit tests" I'd like to incorporate are:
config
hold an expected value?output
at a particular path?Later on it would be cool to also check things like:
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.
The text was updated successfully, but these errors were encountered: