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

Demonstrate nixos-tests #14

Draft
wants to merge 7 commits into
base: consensus
Choose a base branch
from
Draft

Conversation

jsoo1
Copy link

@jsoo1 jsoo1 commented Nov 19, 2024

After obtaining nix on linux (macOS is possible, but quite a bit of work) you can run these tests and explore.

  • nix repl --file /path/to/null-db - inspect nixpkgs and evaluate nix expressions
  • nix-shell /path/to/null-db - jump into a dev environment with the tools used to build null-db
  • nix-build /path/to/null-db --attr null-db - build the null-db in nix and create a symlink to the result in ./result
  • nix-build /path/to/null-db --attr null-db.tests.basic-raft - run a basic nixos-test (currently failing). If it succeeds then a symlink will be created in ./result
  • $(nix-build --no-out-link --attr null-db.tests.basic-raft.driverInteractive)/bin/nixos-test-driver - build and enter a python repl where you can run the vms and test script or otherwise interact with the nixos test environment (no ./result created because of --no-out-link)

Best reviewed per-commit.

There are quite a few finer detailed points worth exploring.

* Ignoring .git and nix directories, as well as any gitignored files
  ensures that the null-db binary is not built more than necessary
  when iterating in development.

* RUSTC_BOOTSTRAP is a workaround - you can use an unstable toolchain
  if you want to using some other overlay or something, but caveat
  emptor.

* The layout with a default.nix in the top-level directory is a
  personal idiom, not exactly worldwide. I like to expose the whole
  package set from the top-level and use the --attr flag to access
  things in there.
The module includes a null-db service with argv and firewall options.

Argv is made a freeform type to allow future flags not to require new options.
@jsoo1 jsoo1 force-pushed the nixos-tests branch 2 times, most recently from 3b38f45 to 6a1fa24 Compare November 19, 2024 10:53
This ensures the diagnostic is printed at program start rather than on
exit. Successful exit is almost guaranteed to never happen.
This is meant for use with `nix-shell` in the project root or
`nix-shell /path/to/project/root`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant