diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d98f5a2 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6c3b4df --- /dev/null +++ b/flake.nix @@ -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 { }; + }); + }; +} diff --git a/packages/vhost-device-sound.nix b/packages/vhost-device-sound.nix new file mode 100644 index 0000000..43b3bf4 --- /dev/null +++ b/packages/vhost-device-sound.nix @@ -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; + }; +})