This flake builds libnbd from nixpkgs and enables ublk support so you get the nbdublk tool, using a packaged ublksrv (from an overlay).
- Nix with flakes enabled
- A Linux kernel (>6.0) with ublk support (for actually using ublk devices)
sudo modprobe ublk_dev
Build libnbd (with nbdublk enabled):
nix build .#libnbd-with-ublknbdublk will be in:
./result/bin/nbdublkThe ublk command used in the nbdublk examples comes from ublksrv, so include it too:
nix shell .#libnbd-with-ublk .#ublksrvmodprob ublk_dev
nbdublk --help
ublk listFor the full usage examples, see the nbdublk(1) man page: