nixpkgs/pkgs/by-name/in/iniparser/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

78 lines
1.9 KiB
Nix

{
lib,
stdenv,
fetchFromGitLab,
fetchFromGitHub,
substituteAll,
symlinkJoin,
cmake,
doxygen,
ruby,
validatePkgConfig,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "iniparser";
version = "4.2.4";
src = fetchFromGitLab {
owner = "iniparser";
repo = "iniparser";
rev = "v${finalAttrs.version}";
hash = "sha256-R069LuOmjCFj7dHXiMjuK7WUupk5+dVd8IDKY/wBn2o=";
};
patches = lib.optionals finalAttrs.finalPackage.doCheck [
(substituteAll {
# Do not let cmake's fetchContent download unity
src = ./remove-fetchcontent-usage.patch;
unitySrc = symlinkJoin {
name = "unity-with-iniparser-config";
paths = [
(fetchFromGitHub {
owner = "throwtheswitch";
repo = "unity";
rev = "v2.6.0";
hash = "sha256-SCcUGNN/UJlu3ALJiZ9bQKxYRZey3cm9QG+NOehp6Ow=";
})
];
postBuild = ''
ln -s ${finalAttrs.src}/test/unity_config.h $out/src/unity_config.h
'';
};
})
];
nativeBuildInputs = [
cmake
doxygen
validatePkgConfig
] ++ lib.optionals finalAttrs.finalPackage.doCheck [ ruby ];
cmakeFlags = [ "-DBUILD_TESTING=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}" ];
doCheck = false;
postFixup = ''
ln -sv $out/include/iniparser/*.h $out/include/
'';
passthru.tests = {
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
iniparser-with-tests = finalAttrs.overrideAttrs (_: {
doCheck = true;
});
};
meta = with lib; {
homepage = "https://gitlab.com/iniparser/iniparser";
description = "Free standalone ini file parsing library";
changelog = "https://gitlab.com/iniparser/iniparser/-/releases/v${finalAttrs.version}";
license = licenses.mit;
platforms = platforms.unix;
pkgConfigModules = [ "iniparser" ];
maintainers = [ maintainers.primeos ];
};
})