From c497663ffc27d338c2a6ea40aca2f65220546189 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Wed, 10 Sep 2025 17:30:16 -0400 Subject: [PATCH 1/3] nuspell: to by-name --- .../nuspell/default.nix => by-name/nu/nuspell/package.nix} | 0 pkgs/{development/libraries => by-name/nu}/nuspell/wrapper.nix | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename pkgs/{development/libraries/nuspell/default.nix => by-name/nu/nuspell/package.nix} (100%) rename pkgs/{development/libraries => by-name/nu}/nuspell/wrapper.nix (100%) diff --git a/pkgs/development/libraries/nuspell/default.nix b/pkgs/by-name/nu/nuspell/package.nix similarity index 100% rename from pkgs/development/libraries/nuspell/default.nix rename to pkgs/by-name/nu/nuspell/package.nix diff --git a/pkgs/development/libraries/nuspell/wrapper.nix b/pkgs/by-name/nu/nuspell/wrapper.nix similarity index 100% rename from pkgs/development/libraries/nuspell/wrapper.nix rename to pkgs/by-name/nu/nuspell/wrapper.nix From 3c718c07e2f9c3b64c9406ecd44c280f85a0ce6f Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Fri, 29 Aug 2025 17:26:56 -0400 Subject: [PATCH 2/3] nuspell: Refactor to finalAttrs, ctestCheckHook --- pkgs/by-name/nu/nuspell/package.nix | 46 +++++++++++++++++++---------- pkgs/top-level/all-packages.nix | 3 +- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/pkgs/by-name/nu/nuspell/package.nix b/pkgs/by-name/nu/nuspell/package.nix index c8c676c27d04..c0caad17608e 100644 --- a/pkgs/by-name/nu/nuspell/package.nix +++ b/pkgs/by-name/nu/nuspell/package.nix @@ -3,21 +3,23 @@ stdenv, fetchFromGitHub, cmake, + ctestCheckHook, buildPackages, pkg-config, icu, catch2_3, + testers, enableManpages ? buildPackages.pandoc.compiler.bootstrapAvailable, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "nuspell"; version = "5.1.6"; src = fetchFromGitHub { owner = "nuspell"; repo = "nuspell"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-U/lHSxpKsBnamf4ikE2aIjEPSU5fxjtuSmhZR0jxMAI="; }; @@ -25,19 +27,17 @@ stdenv.mkDerivation rec { cmake pkg-config ] - ++ lib.optionals enableManpages [ - buildPackages.pandoc - ]; + ++ lib.optional enableManpages buildPackages.pandoc; + strictDeps = true; buildInputs = [ catch2_3 ]; propagatedBuildInputs = [ icu ]; - cmakeFlags = [ - "-DBUILD_TESTING=YES" - ] - ++ lib.optionals (!enableManpages) [ - "-DBUILD_DOCS=OFF" + cmakeFlags = lib.optional (!enableManpages) "-DBUILD_DOCS=OFF"; + + nativeCheckInputs = [ + ctestCheckHook ]; doCheck = true; @@ -48,13 +48,27 @@ stdenv.mkDerivation rec { "dev" ]; - meta = with lib; { + passthru = { + tests = { + 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 = platforms.all; - maintainers = with maintainers; [ fpletz ]; - license = licenses.lgpl3Plus; - changelog = "https://github.com/nuspell/nuspell/blob/v${version}/CHANGELOG.md"; + 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8e8ddc47eec8..4a14cf7821d1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8528,9 +8528,8 @@ with pkgs; nss = nss_esr; nssTools = nss.tools; - nuspell = callPackage ../development/libraries/nuspell { }; nuspellWithDicts = - dicts: callPackage ../development/libraries/nuspell/wrapper.nix { inherit dicts; }; + dicts: callPackage ../by-name/nu/nuspell/wrapper.nix { inherit dicts; }; nv-codec-headers-9 = nv-codec-headers.override { majorVersion = "9"; }; nv-codec-headers-10 = nv-codec-headers.override { majorVersion = "10"; }; From 1b7cdedcf2ad0979da0d6ec802b18cc4e6742886 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Fri, 29 Aug 2025 17:38:33 -0400 Subject: [PATCH 3/3] nuspell: Add withDict wrapper to bring in line with hunspell --- pkgs/by-name/nu/nuspell/package.nix | 7 +++++ pkgs/by-name/nu/nuspell/wrapper.nix | 47 ++++++++++++++++++++--------- pkgs/top-level/all-packages.nix | 5 ++- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/nu/nuspell/package.nix b/pkgs/by-name/nu/nuspell/package.nix index c0caad17608e..bff48444c8b8 100644 --- a/pkgs/by-name/nu/nuspell/package.nix +++ b/pkgs/by-name/nu/nuspell/package.nix @@ -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 { diff --git a/pkgs/by-name/nu/nuspell/wrapper.nix b/pkgs/by-name/nu/nuspell/wrapper.nix index 4bb97e623d38..07d0dd104bf1 100644 --- a/pkgs/by-name/nu/nuspell/wrapper.nix +++ b/pkgs/by-name/nu/nuspell/wrapper.nix @@ -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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4a14cf7821d1..1a046033957f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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"; };