Skip to content

Commit

Permalink
example: Use just for deterministic dataDir location
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Jul 20, 2023
1 parent c127746 commit f3a7ea9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ TODO
- [x] Redis
- [ ] ...

## A note on process working directory

The `dataDir` of these services tend to take *relative* paths, which are usually relative to the project root. As such, when you run these services using `nix run`, their data files are created relative to whichever directory you are in. If you want these data files to always reside relative to the project directory, instead of using `nix run` consider wrapping the process-compose packages in script, via either [mission-control](https://zero-to-flakes.com/mission-control/) module or a [justfile](https://just.systems/). The example uses the latter.

## Contributing

- If you are adding a *new* service, see https://github.com/cachix/devenv/tree/main/src/modules/services for inspiration.
Expand Down
4 changes: 4 additions & 0 deletions example/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
machine.succeed("echo 'SELECT version();' | ${config.services.postgres.pg1.package}/bin/psql -h 127.0.0.1 -U tester ${dbName}")
'';
};

devShells.default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.just ];
};
};
};
}
2 changes: 2 additions & 0 deletions example/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
default:
nix run

0 comments on commit f3a7ea9

Please sign in to comment.