nixpkgs/pkgs/by-name/cg/cg3/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

67 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, runCommand
, dieHook
, cmake
, icu
, boost
}:
let cg3 = stdenv.mkDerivation rec {
pname = "cg3";
version = "1.3.9";
src = fetchFromGitHub {
owner = "GrammarSoft";
repo = "${pname}";
rev = "v${version}";
sha256 = "sha256-TiEhhk90w5GibGZ4yalIf+4qLA8NoU6+GIPN6QNTz2A=";
};
nativeBuildInputs = [
cmake
];
buildInputs = [
icu
boost
];
doCheck = true;
postFixup = ''
substituteInPlace "$out"/lib/pkgconfig/cg3.pc \
--replace '=''${prefix}//' '=/'
'';
passthru.tests.minimal = runCommand "${pname}-test" {
buildInputs = [
cg3
dieHook
];
} ''
echo 'DELIMITERS = "."; ADD (tag) (*);' >grammar.cg3
printf '"<a>"\n\t"a" tag\n\n' >want.txt
printf '"<a>"\n\t"a"\n\n' | vislcg3 -g grammar.cg3 >got.txt
diff -s want.txt got.txt || die "Grammar application did not produce expected parse"
touch $out
'';
# TODO, consider optionals:
# - Enable tcmalloc unless darwin?
# - Enable python bindings?
meta = with lib; {
homepage = "https://github.com/GrammarSoft/cg3";
description = "Constraint Grammar interpreter, compiler and applicator vislcg3";
maintainers = with maintainers; [ unhammer ];
license = licenses.gpl3Plus;
platforms = platforms.all;
};
};
in
cg3