nixpkgs/pkgs/by-name/li/libdovi/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

52 lines
1.3 KiB
Nix

{ lib
, rustPlatform
, fetchCrate
, cargo-c
, rust
, stdenv
}:
rustPlatform.buildRustPackage rec {
pname = "libdovi";
version = "3.3.1";
src = fetchCrate {
pname = "dolby_vision";
inherit version;
hash = "sha256-ecd+r0JWZtP/rxt4Y3Cj2TkygXIMy5KZhZpXBwJNPx4=";
};
cargoLock.lockFile = ./Cargo.lock;
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
nativeBuildInputs = [ cargo-c ];
buildPhase = ''
runHook preBuild
${rust.envVars.setEnv} cargo cbuild -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postBuild
'';
installPhase = ''
runHook preInstall
${rust.envVars.setEnv} cargo cinstall -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postInstall
'';
checkPhase = ''
runHook preCheck
${rust.envVars.setEnv} cargo ctest -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postCheck
'';
meta = with lib; {
description = "C library for Dolby Vision metadata parsing and writing";
homepage = "https://crates.io/crates/dolby_vision";
license = licenses.mit;
maintainers = with maintainers; [ kranzes ];
};
}