Commit d8220bdb authored by Ross Smyth's avatar Ross Smyth
Browse files

hunspell: refactor, add withDict wrapper passthru function

parent c4fae33b
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -58,13 +58,11 @@ stdenv.mkDerivation (finalAttrs: {
  hardeningDisable = [ "format" ];

  passthru = {
    withDicts = callPackage ./wrapper.nix { hunspell = finalAttrs.finalPackage; };
    tests = {
      pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };
      version = testers.testVersion { package = finalAttrs.finalPackage; };
      wrapper = callPackage ./wrapper.nix {
        hunspell = finalAttrs.finalPackage;
        dicts = [ hunspellDicts.en_US ];
      };
      wrapper = finalAttrs.finalPackage.withDicts (d: [ d.en_US ]);
    };

    updateScript = nix-update-script { };
@@ -99,7 +97,10 @@ stdenv.mkDerivation (finalAttrs: {
      lgpl21Plus
      mpl11
    ];
    maintainers = with lib.maintainers; [ getchoo ];
    maintainers = with lib.maintainers; [
      getchoo
      RossSmyth
    ];
    mainProgram = "hunspell";
    platforms = lib.platforms.all;
    pkgConfigModules = [ "hunspell" ];
+31 −25
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  buildEnv,
  hunspell,
  hunspellDicts,
  makeBinaryWrapper,
  dicts ? [ ],
}:
let
  searchPath = lib.makeSearchPath "share/hunspell" dicts;
in
stdenv.mkDerivation {

lib.makeOverridable (
  { ... }@dicts:
  f:
  buildEnv {
    inherit (lib.appendToName "with-dicts" hunspell) name;

    paths = f dicts;

    pathsToLink = [ "/share/hunspell" ];

    nativeBuildInputs = [ makeBinaryWrapper ];

  buildCommand = ''
    postBuild = ''
      makeWrapper ${lib.getExe hunspell} $out/bin/hunspell \
      --prefix DICPATH : ${lib.escapeShellArg searchPath}
        --prefix DICPATH : $out/share/hunspell
    '';

    meta = {
@@ -31,3 +36,4 @@ stdenv.mkDerivation {
        ;
    };
  }
) hunspellDicts
+5 −1
Original line number Diff line number Diff line
@@ -9807,7 +9807,11 @@ with pkgs;
    callPackages ../by-name/hu/hunspell/dictionaries-chromium.nix { }
  );
  hunspellWithDicts = dicts: callPackage ../by-name/hu/hunspell/wrapper.nix { inherit dicts; };
  hunspellWithDicts =
    dicts:
    lib.warn "hunspellWithDicts is deprecated, please use hunspell.withDicts instead."
      hunspell.withDicts
      (_: dicts);
  hydra = callPackage ../by-name/hy/hydra/package.nix { nix = nixVersions.nix_2_28; };