Skip to content

Commit

Permalink
readme: update bazel and nix instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Mar 5, 2021
1 parent bf6a2fc commit 601035a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@ simple distributed register example:
0. Install [`nix`](https://nixos.org/download.html#nix-quick-install);
1. Clone this repository;
2. `cd` into the repository;
3. Install all development tools and compile all components with `nix-shell`
(this can take a while the first time you do it);
4. Prepare the database with `detsys db up`;
5. Start the scheduler component with `detsys scheduler up`;
6. Change directory to where the distributed register example lives with `cd
3. Issue `nix-shell` to get into an environment where all development tools are
available;
4. `bazel build //...` to compile all components;
5. Exit the `nix-shell` with `exit` or `Ctrl-C`;
6. Run `nix-env -if default.nix` to package up and install all binaries that
`bazel` just built;
7. Prepare the database with `detsys db up`;
8. Start the scheduler component with `detsys scheduler up`;
9. Change directory to where the distributed register example lives with `cd
src/sut/register`;
7. Run the first test from the test-suite by typing `go test -run 1`;
8. Notice how test id `1` and run id `2` doesn't pass the analysis. To debug
10. Run the first test from the test-suite by typing `go test -run 1`;
11. Notice how test id `1` and run id `2` doesn't pass the analysis. To debug
that run enter `detsys debug 1 2`;
9. Navigate up and down through the messages with your arrow keys or `j` and
12. Navigate up and down through the messages with your arrow keys or `j` and
`k`, and finally exit the debugger with `q` or `Ctrl-c`.

At this point it might make sense to have a look at the `go` test-suite in
Expand Down
38 changes: 38 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ sources ? import ./nix/sources.nix
, pkgs ? import sources.nixpkgs {} }:
with pkgs;

stdenv.mkDerivation {
pname = "detsys";
version = "latest";

src = ./bazel-bin/src;

phases = [ "installPhase" "installCheckPhase" ];

propagatedBuildInputs = [ z3 ];

installPhase = ''
install -D $src/cli/cli_/cli \
$out/bin/detsys
install -D $src/db/db_/db \
$out/bin/detsys-db
install -D $src/debugger/cmd/detsys-debug/detsys-debug_/detsys-debug \
$out/bin/detsys-debug
install -D $src/scheduler/scheduler-bin \
$out/bin/detsys-scheduler
install -D $src/checker/checker-bin \
$out/bin/detsys-checker
install -D $src/ldfi2/ldfi2 \
$out/bin/detsys-ldfi
'';

doInstallCheck = true;

installCheckPhase = ''
# TODO(stevan): figure out why this doesn't work.
#if [ "$($out/bin/detsys --version)" != "detsys version unknown" ]; then
# echo "version mismatch"
#fi
'';
}

0 comments on commit 601035a

Please sign in to comment.