1{
2 callPackage,
3 lib,
4 stdenv,
5 fetchurl,
6 nixos,
7 testers,
8 versionCheckHook,
9 hello,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "hello";
14 version = "2.12.2";
15
16 src = fetchurl {
17 url = "mirror://gnu/hello/hello-${finalAttrs.version}.tar.gz";
18 hash = "sha256-WpqZbcKSzCTc9BHO6H6S9qrluNE72caBm0x6nc4IGKs=";
19 };
20
21 # The GNU Hello `configure` script detects how to link libiconv but fails to actually make use of that.
22 # Unfortunately, this cannot be a patch to `Makefile.am` because `autoreconfHook` causes a gettext
23 # infrastructure mismatch error when trying to build `hello`.
24 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
25 NIX_LDFLAGS = "-liconv";
26 };
27
28 doCheck = true;
29
30 doInstallCheck = true;
31 nativeInstallCheckInputs = [
32 versionCheckHook
33 ];
34
35 # Give hello some install checks for testing purpose.
36 postInstallCheck = ''
37 stat "''${!outputBin}/bin/${finalAttrs.meta.mainProgram}"
38 '';
39
40 passthru.tests = {
41 version = testers.testVersion { package = hello; };
42 };
43
44 passthru.tests.run = callPackage ./test.nix { hello = finalAttrs.finalPackage; };
45
46 meta = {
47 description = "Program that produces a familiar, friendly greeting";
48 longDescription = ''
49 GNU Hello is a program that prints "Hello, world!" when you run it.
50 It is fully customizable.
51 '';
52 homepage = "https://www.gnu.org/software/hello/manual/";
53 changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${finalAttrs.version}";
54 license = lib.licenses.gpl3Plus;
55 maintainers = with lib.maintainers; [ stv0g ];
56 mainProgram = "hello";
57 platforms = lib.platforms.all;
58 identifiers.cpeParts.vendor = "gnu";
59 };
60})