usbip-rs/flake.nix
Davíð Steinn Geirsson 30d3c9532e feat: add usbip-rs CLI tool with vsock transport
Convert to cargo workspace with lib/ and cli/ crates. Add Nix flake
for building and development. Extract handle_urb_loop and add
read_urb_command to the library for CLI consumption.

Implement the usbip-rs CLI binary with clap subcommands:
- client listen: accept incoming connections via vhci_hcd sysfs
- host connect: passthrough real USB devices via nusb
- test_hid connect: export a simulated HID keyboard for testing

Add vsock transport layer and vhci_hcd sysfs interaction module.
Apply rustfmt formatting project-wide and add rustfmt/clippy to devShell.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:41:42 +00:00

58 lines
1.4 KiB
Nix

{
description = "USB/IP server library and CLI tool";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
nativeBuildInputs = with pkgs; [
rustc
cargo
rustfmt
clippy
pkg-config
];
buildInputs = with pkgs; [
libusb1
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
udev
];
usbip-rs = pkgs.rustPlatform.buildRustPackage {
pname = "usbip-rs";
version = "0.8.0";
src = self;
cargoHash = "sha256-GzISI2C2rJsqMtnmWZFz/XPlVK5BS23+mDVMsCpqJGA=";
inherit nativeBuildInputs buildInputs;
buildFeatures = [ "usbip-rs/serde" ];
meta = with pkgs.lib; {
description = "USB/IP server library and CLI tool";
homepage = "https://github.com/jiegec/usbip";
license = licenses.mit;
mainProgram = "usbip-rs";
};
};
in
{
packages = {
default = usbip-rs;
inherit usbip-rs;
};
devShells.default = pkgs.mkShell {
inherit nativeBuildInputs buildInputs;
};
});
}