42 lines
1.3 KiB
Nix
42 lines
1.3 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = {self, nixpkgs, flake-utils, rust-overlay}:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs {
|
|
inherit system overlays;
|
|
};
|
|
|
|
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
cargo = rustToolchain;
|
|
rustc = rustToolchain;
|
|
};
|
|
rustPackage = crate:
|
|
let cargoToml = builtins.fromTOML (builtins.readFile ./${crate}/Cargo.toml);
|
|
in rustPlatform.buildRustPackage {
|
|
inherit (cargoToml.package) name version;
|
|
src = ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
buildAndTestSubdir = crate;
|
|
};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = [ rustToolchain ];
|
|
};
|
|
|
|
packages.sidebus-agent = rustPackage "sidebus-agent";
|
|
packages.sidebus-broker = rustPackage "sidebus-broker";
|
|
}
|
|
);
|
|
}
|