Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ nix develop --command just bindgen # regenerate src/bindings/libva.rs
```

The crate compiles on macOS for development, with no link-time dependency on
libva.
libva. The dev shell covers Linux and Apple silicon; on an Intel Mac, run
`cargo check` with a local Rust toolchain instead.

## Licensing

Expand Down
96 changes: 92 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 51 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
description = "moq-vaapi - VA-API hardware video codecs (vendored libva)";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# quest's nixpkgs, so every repository's dev shell gets the same C compiler and mbx
# shares build scripts, proc-macros, and the crates built on them across repositories.
nixpkgs.follows = "quest/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# Only its nixpkgs is used.
quest = {
url = "github:kixel-ai/quest";
inputs.flake-utils.follows = "flake-utils";
};
};

outputs =
Expand All @@ -18,43 +25,50 @@
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
# quest's nixpkgs no longer supports x86_64-darwin.
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
]
(
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};

rust-toolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
"rustfmt"
"clippy"
];
};
in
{
devShells.default = pkgs.mkShell {
packages =
with pkgs;
[
rust-toolchain
just
git
cargo-deny
# `just bindgen` regenerates the checked-in bindings; builds need neither it nor libclang.
rust-bindgen
]
++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
# libva is dlopen'd at runtime (not linked at build), so this is only
# needed to actually run vaapi encode in the devShell. macOS has no VAAPI.
libva
rust-toolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
"rustfmt"
"clippy"
];
};
};
in
{
devShells.default = pkgs.mkShell {
packages =
with pkgs;
[
rust-toolchain
just
git
cargo-deny
# `just bindgen` regenerates the checked-in bindings; builds need neither it nor libclang.
rust-bindgen
]
++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
# libva is dlopen'd at runtime (not linked at build), so this is only
# needed to actually run vaapi encode in the devShell. macOS has no VAAPI.
libva
];
};

formatter = pkgs.nixfmt-tree;
}
);
formatter = pkgs.nixfmt-tree;
}
);
}
Loading