diff --git a/pkgs/by-name/gn/gnugrep/package.nix b/pkgs/by-name/gn/gnugrep/package.nix index 9f0ecedd8792..03b965b7268b 100644 --- a/pkgs/by-name/gn/gnugrep/package.nix +++ b/pkgs/by-name/gn/gnugrep/package.nix @@ -15,16 +15,12 @@ # cgit) that are needed here should be included directly in Nixpkgs as # files. -let - version = "3.12"; -in - -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "gnugrep"; - inherit version; + version = "3.12"; src = fetchurl { - url = "mirror://gnu/grep/grep-${version}.tar.xz"; + url = "mirror://gnu/grep/grep-${finalAttrs.version}.tar.xz"; hash = "sha256-JkmyfA6Q5jLq3NdXvgbG6aT0jZQd5R58D4P/dkCKB7k="; }; @@ -39,13 +35,9 @@ stdenv.mkDerivation { # - on Musl: https://github.com/NixOS/nixpkgs/pull/228714 # - on x86_64-darwin: https://github.com/NixOS/nixpkgs/pull/228714#issuecomment-1576826330 # - when building on Darwin (cross-compilation): test-nl_langinfo-mt fails - postPatch = - if stdenv.hostPlatform.isMusl || stdenv.buildPlatform.isDarwin then - '' - sed -i 's:gnulib-tests::g' Makefile.in - '' - else - null; + postPatch = lib.optionalString (stdenv.hostPlatform.isMusl || stdenv.buildPlatform.isDarwin) '' + substituteInPlace Makefile.in --replace-fail "gnulib-tests" "" + ''; nativeCheckInputs = [ perl @@ -63,6 +55,8 @@ stdenv.mkDerivation { ] ++ lib.optional (!stdenv.hostPlatform.isWindows) runtimeShellPackage; + strictDeps = true; + # cygwin: FAIL: multibyte-white-space # freebsd: FAIL mb-non-UTF8-performance # x86_64-darwin: fails 'stack-overflow' tests on Rosetta 2 emulator @@ -97,6 +91,8 @@ stdenv.mkDerivation { NIX_CFLAGS_COMPILE = "-Wno-error=format-security"; }; + __structuredAttrs = true; + meta = { homepage = "https://www.gnu.org/software/grep/"; description = "GNU implementation of the Unix grep command"; @@ -116,7 +112,7 @@ stdenv.mkDerivation { teams = [ lib.teams.security-review ]; platforms = lib.platforms.all; mainProgram = "grep"; - identifiers.cpeParts = lib.meta.cpeFullVersionWithVendor "gnu" version // { + identifiers.cpeParts = lib.meta.cpeFullVersionWithVendor "gnu" finalAttrs.version // { product = "grep"; }; }; @@ -124,4 +120,4 @@ stdenv.mkDerivation { passthru = { inherit pcre2; }; -} +})