nix: add flake with vhost-device-sound package

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Davíð Steinn Geirsson 2026-03-17 20:47:17 +00:00
parent 251237f8cd
commit 323a66d430
3 changed files with 96 additions and 0 deletions

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1773628058,
"narHash": "sha256-hpXH0z3K9xv0fHaje136KY872VT2T5uwxtezlAskQgY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f8573b9c935cfaa162dd62cc9e75ae2db86f85df",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

22
flake.nix Normal file
View file

@ -0,0 +1,22 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{ nixpkgs, ... }:
let
forAllSystems =
f:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system: f nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (pkgs: {
vhost-device-sound = pkgs.callPackage ./packages/vhost-device-sound.nix { };
default = pkgs.callPackage ./packages/vhost-device-sound.nix { };
});
};
}

View file

@ -0,0 +1,47 @@
{
lib,
rustPlatform,
pkg-config,
pipewire,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "vhost-device-sound";
version = "0.3.0";
src = lib.cleanSource ./..;
cargoHash = "sha256-mw0zOCOOT2LmFUGzC4n3YES6R7eaofMsaSYWJpLooAM=";
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [
pipewire
];
cargoBuildFlags = [
"--package"
"vhost-device-sound"
];
cargoTestFlags = [
"--package"
"vhost-device-sound"
];
buildNoDefaultFeatures = true;
buildFeatures = [ "pw-backend" ];
doCheck = false;
meta = {
homepage = "https://git.dsg.is/dsg/vhost-device";
description = "virtio-sound device using the vhost-user protocol (vmsilo fork)";
license = [
lib.licenses.asl20
lib.licenses.bsd3
];
platforms = lib.platforms.linux;
};
})