diff --git a/pkgs/by-name/nu/nuspell/package.nix b/pkgs/by-name/nu/nuspell/package.nix new file mode 100644 index 000000000000..bff48444c8b8 --- /dev/null +++ b/pkgs/by-name/nu/nuspell/package.nix @@ -0,0 +1,81 @@ +{ + lib, + stdenv, + callPackage, + fetchFromGitHub, + cmake, + ctestCheckHook, + buildPackages, + pkg-config, + icu, + catch2_3, + testers, + enableManpages ? buildPackages.pandoc.compiler.bootstrapAvailable, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "nuspell"; + version = "5.1.6"; + + src = fetchFromGitHub { + owner = "nuspell"; + repo = "nuspell"; + tag = "v${finalAttrs.version}"; + hash = "sha256-U/lHSxpKsBnamf4ikE2aIjEPSU5fxjtuSmhZR0jxMAI="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ] + ++ lib.optional enableManpages buildPackages.pandoc; + + strictDeps = true; + buildInputs = [ catch2_3 ]; + + propagatedBuildInputs = [ icu ]; + + cmakeFlags = lib.optional (!enableManpages) "-DBUILD_DOCS=OFF"; + + nativeCheckInputs = [ + ctestCheckHook + ]; + + doCheck = true; + + outputs = [ + "out" + "lib" + "dev" + ]; + + 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 { + moduleNames = [ "Nuspell" ]; + package = finalAttrs.finalPackage; + version = finalAttrs.version; + versionCheck = true; + }; + }; + }; + + meta = { + description = "Free and open source C++ spell checking library"; + mainProgram = "nuspell"; + pkgConfigModules = [ "nuspell" ]; + homepage = "https://nuspell.github.io/"; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ fpletz ]; + license = lib.licenses.lgpl3Plus; + changelog = "https://github.com/nuspell/nuspell/blob/v${finalAttrs.version}/CHANGELOG.md"; + }; +}) diff --git a/pkgs/by-name/nu/nuspell/wrapper.nix b/pkgs/by-name/nu/nuspell/wrapper.nix new file mode 100644 index 000000000000..07d0dd104bf1 --- /dev/null +++ b/pkgs/by-name/nu/nuspell/wrapper.nix @@ -0,0 +1,38 @@ +{ + lib, + buildEnv, + nuspell, + hunspellDicts, + makeBinaryWrapper, +}: + +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 diff --git a/pkgs/development/libraries/nuspell/default.nix b/pkgs/development/libraries/nuspell/default.nix deleted file mode 100644 index c8c676c27d04..000000000000 --- a/pkgs/development/libraries/nuspell/default.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - cmake, - buildPackages, - pkg-config, - icu, - catch2_3, - enableManpages ? buildPackages.pandoc.compiler.bootstrapAvailable, -}: - -stdenv.mkDerivation rec { - pname = "nuspell"; - version = "5.1.6"; - - src = fetchFromGitHub { - owner = "nuspell"; - repo = "nuspell"; - rev = "v${version}"; - hash = "sha256-U/lHSxpKsBnamf4ikE2aIjEPSU5fxjtuSmhZR0jxMAI="; - }; - - nativeBuildInputs = [ - cmake - pkg-config - ] - ++ lib.optionals enableManpages [ - buildPackages.pandoc - ]; - - buildInputs = [ catch2_3 ]; - - propagatedBuildInputs = [ icu ]; - - cmakeFlags = [ - "-DBUILD_TESTING=YES" - ] - ++ lib.optionals (!enableManpages) [ - "-DBUILD_DOCS=OFF" - ]; - - doCheck = true; - - outputs = [ - "out" - "lib" - "dev" - ]; - - meta = with lib; { - description = "Free and open source C++ spell checking library"; - mainProgram = "nuspell"; - homepage = "https://nuspell.github.io/"; - platforms = platforms.all; - maintainers = with maintainers; [ fpletz ]; - license = licenses.lgpl3Plus; - changelog = "https://github.com/nuspell/nuspell/blob/v${version}/CHANGELOG.md"; - }; -} diff --git a/pkgs/development/libraries/nuspell/wrapper.nix b/pkgs/development/libraries/nuspell/wrapper.nix deleted file mode 100644 index 4bb97e623d38..000000000000 --- a/pkgs/development/libraries/nuspell/wrapper.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - stdenv, - lib, - nuspell, - makeWrapper, - dicts ? [ ], -}: - -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" ]; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2e4dd36437cb..a60b9446a57b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8528,9 +8528,11 @@ with pkgs; nss = nss_esr; nssTools = nss.tools; - nuspell = callPackage ../development/libraries/nuspell { }; nuspellWithDicts = - dicts: callPackage ../development/libraries/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"; };