nixpkgs/pkgs/by-name/op/open-english-wordnet/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

81 lines
2.3 KiB
Nix

{
lib,
fetchFromGitHub,
fetchpatch,
gzip,
python3,
stdenvNoCC,
}:
stdenvNoCC.mkDerivation (self: {
pname = "open-english-wordnet";
version = "2022";
src = fetchFromGitHub {
owner = "globalwordnet";
repo = "english-wordnet";
rev = "${self.version}-edition";
hash = "sha256-a1fWIp39uuJZL1aFX/r+ttLB1+kwh/XPHwphgENTQ5M=";
};
patches =
lib.mapAttrsToList
(
rev: hash:
fetchpatch {
url = "https://github.com/globalwordnet/english-wordnet/commit/${rev}.patch";
inherit hash;
}
)
{
# Upstream commit bumping the version number, accidentally ommited from the tagged release
"bc07902f8995b62c70f01a282b23f40f30630540" = "sha256-1e4MG/k86g3OFUhiShCCbNXnvDKrYFr1KlGVsGl++KI=";
# PR #982, “merge.py: Make result independent of filesystem order”
"6da46a48dd76a48ad9ff563e6c807b8271fc83cd" = "sha256-QkkJH7NVGy/IbeSWkotU80IGF4esz0b8mIL9soHdQtQ=";
};
# TODO(nicoo): make compression optional?
nativeBuildInputs = [
gzip
(python3.withPackages (p: with p; [ pyyaml ]))
];
# TODO(nicoo): generate LMF and WNDB versions with separate outputs
buildPhase = ''
runHook preBuild
echo Generating wn.xml
python scripts/from-yaml.py
python scripts/merge.py
echo Compressing
gzip --best --no-name --stdout ./wn.xml > 'oewn:${self.version}.xml.gz'
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dt $out/share/wordnet 'oewn:${self.version}.xml.gz'
runHook postInstall
'';
meta = with lib; {
description = "Lexical network of the English language";
longDescription = ''
Open English WordNet is a lexical network of the English language grouping
words into synsets and linking them according to relationships such as
hypernymy, antonymy and meronymy. It is intended to be used in natural
language processing applications and provides deep lexical information
about the English language as a graph.
Open English WordNet is a fork of the Princeton Wordnet developed under an
open source methodology.
'';
homepage = "https://en-word.net/";
license = licenses.cc-by-40;
maintainers = with maintainers; [ nicoo ];
platforms = platforms.all;
};
})