nuspell: Add withDict wrapper to bring in line with hunspell

This commit is contained in:
Ross Smyth
2025-08-29 17:38:33 -04:00
parent 3c718c07e2
commit 1b7cdedcf2
3 changed files with 44 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
{
lib,
stdenv,
callPackage,
fetchFromGitHub,
cmake,
ctestCheckHook,
@@ -49,7 +50,13 @@ stdenv.mkDerivation (finalAttrs: {
];
passthru = {
withDicts = callPackage ./wrapper.nix { nuspell = finalAttrs.finalPackage; };
tests = {
wrapper = testers.testVersion {
package = finalAttrs.finalPackage.withDicts (d: [ d.en_US ]);
};
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
cmake = testers.hasCmakeConfigModules {

View File

@@ -1,19 +1,38 @@
{
stdenv,
lib,
buildEnv,
nuspell,
makeWrapper,
dicts ? [ ],
hunspellDicts,
makeBinaryWrapper,
}:
let
searchPath = lib.makeSearchPath "share/hunspell" dicts;
in
stdenv.mkDerivation {
name = (lib.appendToName "with-dicts" nuspell).name;
nativeBuildInputs = [ makeWrapper ];
buildCommand = ''
makeWrapper ${nuspell}/bin/nuspell $out/bin/nuspell --prefix DICPATH : ${lib.escapeShellArg searchPath}
'';
meta = removeAttrs nuspell.meta [ "outputsToInstall" ];
}
lib.makeOverridable (
dicts: f:
buildEnv {
inherit (lib.appendToName "with-dicts" nuspell) name version;
paths = f dicts;
pathsToLink = [ "/share/hunspell" ];
nativeBuildInputs = [ makeBinaryWrapper ];
postBuild = ''
makeWrapper ${lib.getExe nuspell} $out/bin/nuspell \
--prefix DICPATH : $out/share/hunspell
'';
meta = {
inherit (nuspell.meta)
description
longDescription
homepage
changelog
license
maintainers
mainProgram
platforms
;
};
}
) hunspellDicts

View File

@@ -8529,7 +8529,10 @@ with pkgs;
nssTools = nss.tools;
nuspellWithDicts =
dicts: callPackage ../by-name/nu/nuspell/wrapper.nix { inherit dicts; };
dicts:
lib.warn "nuspellWithDicts is deprecated, please use nuspell.withDicts instead." nuspell.withDicts (
_: dicts
);
nv-codec-headers-9 = nv-codec-headers.override { majorVersion = "9"; };
nv-codec-headers-10 = nv-codec-headers.override { majorVersion = "10"; };