nixpkgs/pkgs/tools/video/rav1e/default.nix

57 lines
1.7 KiB
Nix
Raw Normal View History

2021-05-30 22:29:16 +00:00
{ stdenv, rustPlatform, rust, fetchurl, fetchFromGitHub, lib, nasm, cargo-c, libiconv }:
2019-12-14 18:18:31 +00:00
2021-05-30 22:29:16 +00:00
let
rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform;
in rustPlatform.buildRustPackage rec {
2019-12-14 18:18:31 +00:00
pname = "rav1e";
2021-04-01 12:04:24 +00:00
version = "0.4.1";
2019-12-14 18:18:31 +00:00
2020-11-19 02:42:33 +00:00
src = stdenv.mkDerivation rec {
name = "${pname}-${version}-source";
src = fetchFromGitHub {
owner = "xiph";
repo = "rav1e";
rev = "v${version}";
2021-04-01 12:04:24 +00:00
sha256 = "0jnq5a3fv6fzzbmprzfxidlcwwgblkwwm0135cfw741wjv7f7h6r";
2020-11-19 02:42:33 +00:00
};
cargoLock = fetchurl {
2021-01-13 16:53:31 +00:00
url = "https://github.com/xiph/rav1e/releases/download/v${version}/Cargo.lock";
2021-04-01 12:04:24 +00:00
sha256 = "14fi9wam9rs5206rvcd2f3sjpzq41pnfml14w74wn2ws3gpi46zn";
2020-11-19 02:42:33 +00:00
};
2019-12-14 18:18:31 +00:00
2020-11-19 02:42:33 +00:00
installPhase = ''
mkdir -p $out
cp -r ./* $out/
cp ${cargoLock} $out/Cargo.lock
'';
};
2019-12-14 18:18:31 +00:00
cargoSha256 = "0miq6iiywwbxm6k0alnqg6bnd14pwc8vl9d8fgg6c0vjlfy5zhlb";
nativeBuildInputs = [ nasm cargo-c ];
2021-04-01 12:05:00 +00:00
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
postBuild = ''
2021-05-30 22:29:16 +00:00
cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
'';
postInstall = ''
2021-05-30 22:29:16 +00:00
cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
'';
2019-12-14 18:18:31 +00:00
meta = with lib; {
description = "The fastest and safest AV1 encoder";
longDescription = ''
rav1e is an AV1 video encoder. It is designed to eventually cover all use
cases, though in its current form it is most suitable for cases where
libaom (the reference encoder) is too slow.
Features: https://github.com/xiph/rav1e#features
'';
2020-11-19 13:07:16 +00:00
homepage = "https://github.com/xiph/rav1e";
2020-05-29 19:16:25 +00:00
changelog = "https://github.com/xiph/rav1e/releases/tag/v${version}";
2019-12-14 18:18:31 +00:00
license = licenses.bsd2;
maintainers = [ ];
2019-12-14 18:18:31 +00:00
};
}