about summary refs log tree commit diff
path: root/pkgs/by-name/ra
diff options
context:
space:
mode:
authorseth <getchoo@tuta.io>2024-06-11 20:26:47 -0400
committerseth <getchoo@tuta.io>2024-06-12 03:28:22 -0400
commit1cc5cb9434eb7a6886684bffbcdf766b2db471dd (patch)
tree06524858d017f703c6ed544c07006dcbe954b085 /pkgs/by-name/ra
parent0b3a8c0684d7011338a93e575f3485e85c246397 (diff)
rav1e: migrate to by-name
Diffstat (limited to 'pkgs/by-name/ra')
-rw-r--r--pkgs/by-name/ra/rav1e/package.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/by-name/ra/rav1e/package.nix b/pkgs/by-name/ra/rav1e/package.nix
new file mode 100644
index 0000000000000..d2e7695683394
--- /dev/null
+++ b/pkgs/by-name/ra/rav1e/package.nix
@@ -0,0 +1,68 @@
+{ lib
+, rust
+, stdenv
+, rustPlatform
+, fetchCrate
+, pkg-config
+, cargo-c
+, libgit2
+, nasm
+, zlib
+, libiconv
+, darwin
+, buildPackages
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "rav1e";
+  version = "0.7.1";
+
+  src = fetchCrate {
+    inherit pname version;
+    sha256 = "sha256-Db7qb7HBAy6lniIiN07iEzURmbfNtuhmgJRv7OUagUM=";
+  };
+
+  cargoHash = "sha256-VyQ6n2kIJ7OjK6Xlf0T0GNsBvgESRETzKZDZzAn8ZuY=";
+
+  depsBuildBuild = [ pkg-config ];
+
+  nativeBuildInputs = [ cargo-c libgit2 nasm ];
+
+  buildInputs = [
+    zlib
+  ] ++ lib.optionals stdenv.isDarwin [
+    libiconv
+    darwin.apple_sdk.frameworks.Security
+  ];
+
+  # Darwin uses `llvm-strip`, which results in link errors when using `-x` to strip the asm library
+  # and linking it with cctools ld64.
+  postPatch = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
+    substituteInPlace build.rs --replace-fail '.arg("-x")' '.arg("-S")'
+  '';
+
+  checkType = "debug";
+
+  postBuild =  ''
+    ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
+  '';
+
+  postInstall = ''
+    ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
+  '';
+
+  meta = with lib; {
+    description = "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
+    '';
+    homepage = "https://github.com/xiph/rav1e";
+    changelog = "https://github.com/xiph/rav1e/releases/tag/v${version}";
+    license = licenses.bsd2;
+    maintainers = [ ];
+    mainProgram = "rav1e";
+  };
+}