Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
113 lines
2.6 KiB
Nix
113 lines
2.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
rust,
|
|
rustPlatform,
|
|
hdr10plus_tool,
|
|
cargo-c,
|
|
fontconfig,
|
|
}:
|
|
|
|
let
|
|
inherit (lib) optionals concatStringsSep;
|
|
inherit (rust.envVars) setEnv;
|
|
in
|
|
rustPlatform.buildRustPackage (finalAttrs: {
|
|
__structuredAttrs = true;
|
|
|
|
pname = "hdr10plus";
|
|
# Version of the library, not the tool
|
|
# See https://github.com/quietvoid/hdr10plus_tool/blob/main/hdr10plus/Cargo.toml
|
|
version = "2.1.4";
|
|
|
|
outputs = [
|
|
"out"
|
|
"dev"
|
|
];
|
|
|
|
inherit (hdr10plus_tool) src cargoDeps cargoHash;
|
|
|
|
nativeBuildInputs = [ cargo-c ];
|
|
buildInputs = [ fontconfig ];
|
|
|
|
cargoCFlags = [
|
|
"--package=hdr10plus"
|
|
"--frozen"
|
|
"--prefix=${placeholder "out"}"
|
|
"--includedir=${placeholder "dev"}/include"
|
|
"--pkgconfigdir=${placeholder "dev"}/lib/pkgconfig"
|
|
"--target=${stdenv.hostPlatform.rust.rustcTarget}"
|
|
];
|
|
|
|
# mirror Cargo flags
|
|
cargoCBuildFlags =
|
|
optionals (finalAttrs.cargoBuildType != "debug") [
|
|
"--profile=${finalAttrs.cargoBuildType}"
|
|
]
|
|
++ optionals (finalAttrs.cargoBuildNoDefaultFeatures) [
|
|
"--no-default-features"
|
|
]
|
|
++ optionals (finalAttrs.cargoBuildFeatures != [ ]) [
|
|
"--features=${concatStringsSep "," finalAttrs.cargoBuildFeatures}"
|
|
];
|
|
|
|
cargoCTestFlags =
|
|
optionals (finalAttrs.cargoCheckType != "debug") [
|
|
"--profile=${finalAttrs.cargoCheckType}"
|
|
]
|
|
++ optionals (finalAttrs.cargoCheckNoDefaultFeatures) [
|
|
"--no-default-features"
|
|
]
|
|
++ optionals (finalAttrs.cargoCheckFeatures != [ ]) [
|
|
"--features=${concatStringsSep "," finalAttrs.cargoCheckFeatures}"
|
|
];
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
|
|
# let stdenv handle stripping
|
|
export "CARGO_PROFILE_''${cargoBuildType@U}_STRIP"=false
|
|
|
|
prependToVar cargoCFlags -j "$NIX_BUILD_CORES"
|
|
|
|
runHook postConfigure
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
${setEnv} cargo cbuild "''${cargoCFlags[@]}" "''${cargoCBuildFlags[@]}"
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
|
|
${setEnv} cargo ctest "''${cargoCFlags[@]}" "''${cargoCTestFlags[@]}"
|
|
|
|
runHook postCheck
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
${setEnv} cargo cinstall "''${cargoCFlags[@]}" "''${cargoCBuildFlags[@]}"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.tests = {
|
|
inherit hdr10plus_tool;
|
|
};
|
|
|
|
meta = {
|
|
description = "Library to work with HDR10+ in HEVC files";
|
|
homepage = "https://github.com/quietvoid/hdr10plus_tool";
|
|
changelog = "https://github.com/quietvoid/hdr10plus_tool/releases/tag/${hdr10plus_tool.version}";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ mvs ];
|
|
pkgConfigModules = [ "hdr10plus-rs" ];
|
|
};
|
|
})
|