Configure devenv to build output
This commit is contained in:
+32
-5
@@ -6,6 +6,33 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# devenv's `languages.rust.import` only builds single root-package crates
|
||||||
|
# (it hardcodes `cargoNix.rootCrate.build`). musicfs is a virtual workspace with
|
||||||
|
# no root package, so we drive crate2nix directly and select the `musicfs-client`
|
||||||
|
# member out of `workspaceMembers`. src = ./. gives crate2nix the whole workspace,
|
||||||
|
# so the member's path-dependencies (musicfs-core, musicfs-proto) resolve.
|
||||||
|
crate2nixTools = pkgs.callPackage "${inputs.crate2nix}/tools.nix" { };
|
||||||
|
cargoNix =
|
||||||
|
pkgs.callPackage
|
||||||
|
(crate2nixTools.generatedCargoNix {
|
||||||
|
name = "musicfs";
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# musicfs-client's binary is named `musicfs` (see [[bin]] in its Cargo.toml).
|
||||||
|
musicfs = cargoNix.workspaceMembers."musicfs-client".build;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
languages.rust.enable = true;
|
languages.rust.enable = true;
|
||||||
git-hooks.hooks = {
|
git-hooks.hooks = {
|
||||||
@@ -42,7 +69,7 @@
|
|||||||
processes.musicfs = {
|
processes.musicfs = {
|
||||||
after = [ "devenv:processes:postgres" ];
|
after = [ "devenv:processes:postgres" ];
|
||||||
exec = lib.mkDefault ''
|
exec = lib.mkDefault ''
|
||||||
cargo run -p musicfs-client -- \
|
${musicfs}/bin/musicfs \
|
||||||
--source /home/fujin/Music \
|
--source /home/fujin/Music \
|
||||||
--mountpoint /tmp/rust-fuse \
|
--mountpoint /tmp/rust-fuse \
|
||||||
--database "postgresql://fujin@localhost/musicfs?host=$PGHOST"
|
--database "postgresql://fujin@localhost/musicfs?host=$PGHOST"
|
||||||
@@ -53,7 +80,7 @@
|
|||||||
processes.musicfs = {
|
processes.musicfs = {
|
||||||
after = [ "devenv:processes:postgres" ];
|
after = [ "devenv:processes:postgres" ];
|
||||||
exec = ''
|
exec = ''
|
||||||
cargo run -p musicfs-client -- \
|
${musicfs}/bin/musicfs \
|
||||||
--source /home/fujin/Music \
|
--source /home/fujin/Music \
|
||||||
--mountpoint /tmp/rust-fuse \
|
--mountpoint /tmp/rust-fuse \
|
||||||
--database "postgresql://fujin@localhost/musicfs?host=$PGHOST"
|
--database "postgresql://fujin@localhost/musicfs?host=$PGHOST"
|
||||||
@@ -65,7 +92,7 @@
|
|||||||
processes.musicfs = {
|
processes.musicfs = {
|
||||||
after = [ "devenv:processes:postgres" ];
|
after = [ "devenv:processes:postgres" ];
|
||||||
exec = ''
|
exec = ''
|
||||||
cargo run -p musicfs-client -- \
|
${musicfs}/bin/musicfs \
|
||||||
--source http://10.185.226.145:50051 \
|
--source http://10.185.226.145:50051 \
|
||||||
--mountpoint /tmp/rust-fuse \
|
--mountpoint /tmp/rust-fuse \
|
||||||
--database "postgresql://fujin@localhost/musicfs?host=$PGHOST"
|
--database "postgresql://fujin@localhost/musicfs?host=$PGHOST"
|
||||||
@@ -77,7 +104,7 @@
|
|||||||
processes.musicfs = {
|
processes.musicfs = {
|
||||||
after = [ "devenv:processes:postgres" ];
|
after = [ "devenv:processes:postgres" ];
|
||||||
exec = ''
|
exec = ''
|
||||||
cargo run -p musicfs-client -- \
|
${musicfs}/bin/musicfs \
|
||||||
--source http://127.0.0.1:50061 \
|
--source http://127.0.0.1:50061 \
|
||||||
--mountpoint ./target/e2e/mnt \
|
--mountpoint ./target/e2e/mnt \
|
||||||
--database "postgresql://fujin@localhost/musicfs_e2e?host=$PGHOST" \
|
--database "postgresql://fujin@localhost/musicfs_e2e?host=$PGHOST" \
|
||||||
@@ -101,6 +128,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
rust-app = config.languages.rust.import ./. { };
|
musicfs = musicfs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user