Configure devenv to build output
This commit is contained in:
+26
-2
@@ -6,6 +6,30 @@
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
# devenv's `languages.rust.import` only builds single root-package crates
|
||||
# (it hardcodes `cargoNix.rootCrate.build`). tora is a virtual workspace with
|
||||
# no root package, so we drive crate2nix directly and select the `torad` member
|
||||
# out of `workspaceMembers`. src = ./. gives crate2nix the whole workspace, so
|
||||
# torad's path-dependency on ../proto (tora-proto) resolves.
|
||||
crate2nixTools = pkgs.callPackage "${inputs.crate2nix}/tools.nix" { };
|
||||
cargoNix =
|
||||
pkgs.callPackage
|
||||
(crate2nixTools.generatedCargoNix {
|
||||
name = "tora";
|
||||
src = ./.;
|
||||
})
|
||||
{
|
||||
# Build with the toolchain configured for this dev environment,
|
||||
# matching what languages.rust.import does internally.
|
||||
buildRustCrateForPkgs =
|
||||
_:
|
||||
pkgs.buildRustCrate.override {
|
||||
rustc = config.languages.rust.toolchainPackage;
|
||||
cargo = config.languages.rust.toolchainPackage;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
languages.rust.enable = true;
|
||||
git-hooks.hooks = {
|
||||
@@ -57,13 +81,13 @@
|
||||
|
||||
processes.torad = {
|
||||
exec = ''
|
||||
cargo run -p torad -- --socket "$TORAD_SOCKET" --pid-file "$TORAD_PID_FILE"
|
||||
${config.outputs.torad}/bin/torad --socket "$TORAD_SOCKET" --pid-file "$TORAD_PID_FILE"
|
||||
'';
|
||||
# Waits for postgres's own readiness probe (pg_isready + SELECT 1), not just process start.
|
||||
after = [ "devenv:processes:postgres" ];
|
||||
};
|
||||
|
||||
outputs = {
|
||||
tora = config.languages.rust.import ./. { };
|
||||
torad = cargoNix.workspaceMembers.torad.build;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user